mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- binaryangle.h: Expand all classes with bit-shift operators and binangle
/lookangle
classes with some lt/le/ge/gt bools to have parity with the fixedhoriz
class.
This commit is contained in:
parent
42689e02c4
commit
35845a63e2
1 changed files with 104 additions and 0 deletions
|
@ -141,6 +141,25 @@ public:
|
|||
int bsin(const int8_t& shift = 0) const { return ::bsin(asbuild(), shift); }
|
||||
int bcos(const int8_t& shift = 0) const { return ::bcos(asbuild(), shift); }
|
||||
|
||||
bool operator< (binangle other) const
|
||||
{
|
||||
return value < other.value;
|
||||
}
|
||||
|
||||
bool operator> (binangle other) const
|
||||
{
|
||||
return value > other.value;
|
||||
}
|
||||
|
||||
bool operator<= (binangle other) const
|
||||
{
|
||||
return value <= other.value;
|
||||
}
|
||||
|
||||
bool operator>= (binangle other) const
|
||||
{
|
||||
return value >= other.value;
|
||||
}
|
||||
constexpr bool operator== (binangle other) const
|
||||
{
|
||||
return value == other.value;
|
||||
|
@ -173,6 +192,28 @@ public:
|
|||
return binangle(value - other.value);
|
||||
}
|
||||
|
||||
constexpr binangle &operator<<= (const uint8_t& shift)
|
||||
{
|
||||
value <<= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr binangle &operator>>= (const uint8_t& shift)
|
||||
{
|
||||
value >>= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr binangle operator<< (const uint8_t& shift) const
|
||||
{
|
||||
return binangle(value << shift);
|
||||
}
|
||||
|
||||
constexpr binangle operator>> (const uint8_t& shift) const
|
||||
{
|
||||
return binangle(value >> shift);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline constexpr binangle bamang(uint32_t v) { return binangle(v); }
|
||||
|
@ -223,6 +264,25 @@ public:
|
|||
int bsin(const int8_t& shift = 0) const { return ::bsin(asbuild(), shift); }
|
||||
int bcos(const int8_t& shift = 0) const { return ::bcos(asbuild(), shift); }
|
||||
|
||||
bool operator< (lookangle other) const
|
||||
{
|
||||
return value < other.value;
|
||||
}
|
||||
|
||||
bool operator> (lookangle other) const
|
||||
{
|
||||
return value > other.value;
|
||||
}
|
||||
|
||||
bool operator<= (lookangle other) const
|
||||
{
|
||||
return value <= other.value;
|
||||
}
|
||||
|
||||
bool operator>= (lookangle other) const
|
||||
{
|
||||
return value >= other.value;
|
||||
}
|
||||
constexpr bool operator== (lookangle other) const
|
||||
{
|
||||
return value == other.value;
|
||||
|
@ -255,6 +315,28 @@ public:
|
|||
return lookangle(value - other.value);
|
||||
}
|
||||
|
||||
constexpr lookangle &operator<<= (const uint8_t& shift)
|
||||
{
|
||||
value <<= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr lookangle &operator>>= (const uint8_t& shift)
|
||||
{
|
||||
value >>= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr lookangle operator<< (const uint8_t& shift) const
|
||||
{
|
||||
return lookangle(value << shift);
|
||||
}
|
||||
|
||||
constexpr lookangle operator>> (const uint8_t& shift) const
|
||||
{
|
||||
return lookangle(value >> shift);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline constexpr lookangle bamlook(int32_t v) { return lookangle(v); }
|
||||
|
@ -377,6 +459,28 @@ public:
|
|||
return fixedhoriz(value - other.value);
|
||||
}
|
||||
|
||||
constexpr fixedhoriz &operator<<= (const uint8_t& shift)
|
||||
{
|
||||
value <<= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr fixedhoriz &operator>>= (const uint8_t& shift)
|
||||
{
|
||||
value >>= shift;
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr fixedhoriz operator<< (const uint8_t& shift) const
|
||||
{
|
||||
return fixedhoriz(value << shift);
|
||||
}
|
||||
|
||||
constexpr fixedhoriz operator>> (const uint8_t& shift) const
|
||||
{
|
||||
return fixedhoriz(value >> shift);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
inline constexpr fixedhoriz q16horiz(fixed_t v) { return fixedhoriz(v); }
|
||||
|
|
Loading…
Reference in a new issue