Welcome to mirror list, hosted at ThFree Co, Russian Federation.

pointu_to_uint64.hpp « geometry - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3ea17330cf0c2405cfc851eb877e399e5f40149d (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 "geometry/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