mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
Add double variants of SetValue() for numeric PTypes
This commit is contained in:
parent
e2711a74e7
commit
feb5ab31cc
2 changed files with 33 additions and 1 deletions
|
@ -392,7 +392,12 @@ bool PType::VisitedNodeSet::Check(const PType *node)
|
|||
|
||||
void PType::SetValue(void *addr, int val)
|
||||
{
|
||||
assert(0 && "Cannot set value for this type");
|
||||
assert(0 && "Cannot set int value for this type");
|
||||
}
|
||||
|
||||
void PType::SetValue(void *addr, double val)
|
||||
{
|
||||
assert(0 && "Cannot set float value for this type");
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -682,6 +687,11 @@ void PInt::SetValue(void *addr, int val)
|
|||
}
|
||||
}
|
||||
|
||||
void PInt::SetValue(void *addr, double val)
|
||||
{
|
||||
SetValue(addr, (int)val);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PInt :: GetValueInt
|
||||
|
@ -927,6 +937,11 @@ void PFloat::SetSymbols(const PFloat::SymbolInitI *sym, size_t count)
|
|||
//==========================================================================
|
||||
|
||||
void PFloat::SetValue(void *addr, int val)
|
||||
{
|
||||
return SetValue(addr, (double)val);
|
||||
}
|
||||
|
||||
void PFloat::SetValue(void *addr, double val)
|
||||
{
|
||||
assert(((intptr_t)addr & (Align - 1)) == 0 && "unaligned address");
|
||||
if (Size == 4)
|
||||
|
@ -1112,6 +1127,12 @@ void PFixed::SetValue(void *addr, int val)
|
|||
*(fixed_t *)addr = val << FRACBITS;
|
||||
}
|
||||
|
||||
void PFixed::SetValue(void *addr, double val)
|
||||
{
|
||||
assert(((intptr_t)addr & (Align - 1)) == 0 && "unaligned address");
|
||||
*(fixed_t *)addr = FLOAT2FIXED(val);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PFixed :: GetValueInt
|
||||
|
@ -1173,6 +1194,12 @@ void PAngle::SetValue(void *addr, int val)
|
|||
*(angle_t *)addr = Scale(val, ANGLE_90, 90);
|
||||
}
|
||||
|
||||
void PAngle::SetValue(void *addr, double val)
|
||||
{
|
||||
assert(((intptr_t)addr & (Align - 1)) == 0 && "unaligned address");
|
||||
*(angle_t *)addr = (angle_t)(val * ANGLE_90 / 90);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// PAngle :: GetValueInt
|
||||
|
|
|
@ -188,6 +188,7 @@ public:
|
|||
|
||||
// Sets the value of a variable of this type at (addr)
|
||||
virtual void SetValue(void *addr, int val);
|
||||
virtual void SetValue(void *addr, double val);
|
||||
|
||||
// Gets the value of a variable of this type at (addr)
|
||||
virtual int GetValueInt(void *addr) const;
|
||||
|
@ -320,6 +321,7 @@ public:
|
|||
PInt(unsigned int size, bool unsign);
|
||||
|
||||
virtual void SetValue(void *addr, int val);
|
||||
virtual void SetValue(void *addr, double val);
|
||||
virtual int GetValueInt(void *addr) const;
|
||||
virtual int GetStoreOp() const;
|
||||
virtual int GetLoadOp() const;
|
||||
|
@ -344,6 +346,7 @@ public:
|
|||
PFloat(unsigned int size);
|
||||
|
||||
virtual void SetValue(void *addr, int val);
|
||||
virtual void SetValue(void *addr, double val);
|
||||
virtual int GetValueInt(void *addr) const;
|
||||
virtual int GetStoreOp() const;
|
||||
virtual int GetLoadOp() const;
|
||||
|
@ -410,6 +413,7 @@ public:
|
|||
PFixed();
|
||||
|
||||
virtual void SetValue(void *addr, int val);
|
||||
virtual void SetValue(void *addr, double val);
|
||||
virtual int GetValueInt(void *addr) const;
|
||||
virtual int GetStoreOp() const;
|
||||
virtual int GetLoadOp() const;
|
||||
|
@ -422,6 +426,7 @@ public:
|
|||
PAngle();
|
||||
|
||||
virtual void SetValue(void *addr, int val);
|
||||
virtual void SetValue(void *addr, double val);
|
||||
virtual int GetValueInt(void *addr) const;
|
||||
virtual int GetStoreOp() const;
|
||||
virtual int GetLoadOp() const;
|
||||
|
|
Loading…
Reference in a new issue