Fix getters for negative numbers
This commit is contained in:
@@ -86,9 +86,9 @@ namespace openVulkanoCpp::Math
|
|||||||
|
|
||||||
constexpr T Data() const { return data; }
|
constexpr T Data() const { return data; }
|
||||||
|
|
||||||
[[nodiscard]] constexpr int X() const { return static_cast<int>(data & BITMASK); }
|
[[nodiscard]] constexpr int X() const { int v = data & BITMASK; if (v > MAX_VALUE) v |= ~BITMASK; return reinterpret_cast<int&>(v); }
|
||||||
[[nodiscard]] constexpr int Y() const { return static_cast<int>((data >> (2 * BITS)) & BITMASK); }
|
[[nodiscard]] constexpr int Y() const { int v = (data >> (2 * BITS)) & BITMASK; if (v > MAX_VALUE_Y) v |= ~BITMASK; return reinterpret_cast<int&>(v); }
|
||||||
[[nodiscard]] constexpr int Z() const { return static_cast<int>((data >> BITS) & BITMASK); }
|
[[nodiscard]] constexpr int Z() const { int v = (data >> BITS) & BITMASK; if (v > MAX_VALUE) v |= ~BITMASK; return reinterpret_cast<int&>(v); }
|
||||||
|
|
||||||
void SetX(int x)
|
void SetX(int x)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user