diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-17 10:24:37 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-17 10:24:37 +0200 |
commit | 3b2e2ed05b593f2fdd8ec7153bddb6cd8dd1e246 (patch) | |
tree | 9ed08a91d0462154ff39ad759c648fb640fac07a /src/global-coords.cpp | |
parent | 8bf700d1b2a5cbb7cfd99ca8a0492b2a5bfd2f3a (diff) |
a
Diffstat (limited to 'src/global-coords.cpp')
-rw-r--r-- | src/global-coords.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/global-coords.cpp b/src/global-coords.cpp new file mode 100644 index 00000000..997f1c11 --- /dev/null +++ b/src/global-coords.cpp @@ -0,0 +1,17 @@ +#include "global-coords.hpp" + +namespace floormat { + +static_assert(sizeof(decltype(local_coords::x))*8 == 8); +static_assert(sizeof(decltype(chunk_coords::x))*8 == 16); +static_assert(std::is_same_v<decltype(local_coords::x), decltype(local_coords::y)>); +static_assert(std::is_same_v<decltype(chunk_coords::x), decltype(chunk_coords::y)>); + +static_assert(std::is_same_v<decltype(chunk_coords::x), decltype(chunk_coords::y)>); + +static_assert(global_coords{{-1, -1}, {2, 3}} == global_coords{((-1 + (1 << 15)) << 4) + 2, ((-1 + (1 << 15)) << 4) + 3}); +static_assert(global_coords{15, 15}.chunk() == global_coords{}.chunk()); +static_assert(global_coords{15, 16}.chunk() != global_coords{}.chunk()); +static_assert(global_coords{(1 + (1<<15)) << 4 | 3, (2 + (1<<15)) << 4 | 4} == global_coords{{1, 2}, {3, 4}}); + +} // namespace floormat |