mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 20:40:47 +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 bsin(const int8_t& shift = 0) const { return ::bsin(asbuild(), shift); }
|
||||||
int bcos(const int8_t& shift = 0) const { return ::bcos(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
|
constexpr bool operator== (binangle other) const
|
||||||
{
|
{
|
||||||
return value == other.value;
|
return value == other.value;
|
||||||
|
@ -173,6 +192,28 @@ public:
|
||||||
return binangle(value - other.value);
|
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); }
|
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 bsin(const int8_t& shift = 0) const { return ::bsin(asbuild(), shift); }
|
||||||
int bcos(const int8_t& shift = 0) const { return ::bcos(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
|
constexpr bool operator== (lookangle other) const
|
||||||
{
|
{
|
||||||
return value == other.value;
|
return value == other.value;
|
||||||
|
@ -255,6 +315,28 @@ public:
|
||||||
return lookangle(value - other.value);
|
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); }
|
inline constexpr lookangle bamlook(int32_t v) { return lookangle(v); }
|
||||||
|
@ -377,6 +459,28 @@ public:
|
||||||
return fixedhoriz(value - other.value);
|
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); }
|
inline constexpr fixedhoriz q16horiz(fixed_t v) { return fixedhoriz(v); }
|
||||||
|
|
Loading…
Reference in a new issue