blob: 9c074cde0e8705432c3374ce92c18df6b7ab0263 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#pragma once
#include "../base/assert.hpp"
#include "../base/base.hpp"
#include "../base/bits.hpp"
#include "point2d.hpp"
namespace m2
{
inline PointU Uint64ToPointU(int64_t v)
{
PointU res;
bits::BitwiseSplit(v, res.x, res.y);
return res;
}
inline uint64_t PointUToUint64(PointU const & pt)
{
uint64_t const res = bits::BitwiseMerge(pt.x, pt.y);
ASSERT_EQUAL(pt, Uint64ToPointU(res), ());
return res;
}
} // namespace m2
|