27 static constexpr uint64_t Offset = 8 *
sizeof(uint64_t) / 2;
28 static constexpr uint32_t HalfRange =
29 static_cast<uint32_t
>(1) << (8 *
sizeof(int32_t) - 1);
32 inline int GetX(
void)
const {
return X; }
33 inline int GetY(
void)
const {
return Y; }
34 inline int GetZ(
void)
const {
return -(X + Y); }
44 ::std::pair<float, float> ToPlane(
void)
const;
45 uint64_t GetHash(
void)
const;
51 explicit CubeCoords(
const int = 0,
const int = 0);
57 return CubeCoords{ X + _CubeCoords.X, Y + _CubeCoords.Y };
60 inline CubeCoords CubeCoords::operator - (
const CubeCoords & _CubeCoords)
const
62 return CubeCoords{ X - _CubeCoords.X, Y - _CubeCoords.Y };
65 inline CubeCoords CubeCoords::operator * (
const int32_t _Value)
const
67 return CubeCoords{ X * _Value, Y * _Value };
70 inline uint64_t CubeCoords::GetHash(
void)
const
73 # pragma warning(push)
74 # pragma warning(disable: 26451)
77 return (
static_cast<uint64_t
>(Y + HalfRange) << Offset) +
78 static_cast<uint64_t
>(X + HalfRange);