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

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2018-04-09 14:27:33 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2018-04-10 14:31:32 +0300
commit8651b85289754a09b662e0412b5cae172284c3be (patch)
tree08d176fad5682b2b54397c3066b5cc553846b4c5 /geometry
parent9666660b84740e6bbe0585e59fccd1347c4c793f (diff)
[coding] [geometry] Deprecated PointToInt.
For some reason we have been using bitwise merge to store a pair of 32-bit unsigned integer coordinates. Since the width of the coordinates is fixed and storage in general has nothing to do with the Z-order curve where bitwise merge is appropriate, this commit marks this method of storage as obsolete (and effectively deprecated). The functions to convert between PointD and PointU are still serviceable. Their usage is slightly refactored.
Diffstat (limited to 'geometry')
-rw-r--r--geometry/CMakeLists.txt1
-rw-r--r--geometry/geometry_tests/CMakeLists.txt1
-rw-r--r--geometry/geometry_tests/pointu_to_uint64_test.cpp28
-rw-r--r--geometry/pointu_to_uint64.hpp24
4 files changed, 0 insertions, 54 deletions
diff --git a/geometry/CMakeLists.txt b/geometry/CMakeLists.txt
index 7c42d28dde..308cf97e5c 100644
--- a/geometry/CMakeLists.txt
+++ b/geometry/CMakeLists.txt
@@ -35,7 +35,6 @@ set(
packer.cpp
packer.hpp
point2d.hpp
- pointu_to_uint64.hpp
polygon.hpp
polyline2d.hpp
rect2d.hpp
diff --git a/geometry/geometry_tests/CMakeLists.txt b/geometry/geometry_tests/CMakeLists.txt
index cadc7921bd..594287dfa5 100644
--- a/geometry/geometry_tests/CMakeLists.txt
+++ b/geometry/geometry_tests/CMakeLists.txt
@@ -26,7 +26,6 @@ set(
mercator_test.cpp
packer_test.cpp
point_test.cpp
- pointu_to_uint64_test.cpp
polygon_test.cpp
rect_test.cpp
region2d_binary_op_test.cpp
diff --git a/geometry/geometry_tests/pointu_to_uint64_test.cpp b/geometry/geometry_tests/pointu_to_uint64_test.cpp
deleted file mode 100644
index c890a17476..0000000000
--- a/geometry/geometry_tests/pointu_to_uint64_test.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "testing/testing.hpp"
-#include "geometry/pointu_to_uint64.hpp"
-
-UNIT_TEST(PointUToUint64_0)
-{
- TEST_EQUAL(0, m2::PointUToUint64(m2::PointU(0, 0)), ());
- TEST_EQUAL(m2::PointU(0, 0), m2::Uint64ToPointU(0), ());
-}
-
-UNIT_TEST(PointUToUint64_Interlaced)
-{
- TEST_EQUAL(0xAAAAAAAAAAAAAAAAULL, m2::PointUToUint64(m2::PointU(0, 0xFFFFFFFF)), ());
- TEST_EQUAL(0x5555555555555555ULL, m2::PointUToUint64(m2::PointU(0xFFFFFFFF, 0)), ());
- TEST_EQUAL(0xAAAAAAAAAAAAAAA8ULL, m2::PointUToUint64(m2::PointU(0, 0xFFFFFFFE)), ());
- TEST_EQUAL(0x5555555555555554ULL, m2::PointUToUint64(m2::PointU(0xFFFFFFFE, 0)), ());
-}
-
-UNIT_TEST(PointUToUint64_1bit)
-{
- TEST_EQUAL(2, m2::PointUToUint64(m2::PointU(0, 1)), ());
- TEST_EQUAL(m2::PointU(0, 1), m2::Uint64ToPointU(2), ());
- TEST_EQUAL(1, m2::PointUToUint64(m2::PointU(1, 0)), ());
- TEST_EQUAL(m2::PointU(1, 0), m2::Uint64ToPointU(1), ());
-
- TEST_EQUAL(3ULL << 60, m2::PointUToUint64(m2::PointU(1 << 30, 1 << 30)), ());
- TEST_EQUAL((1ULL << 60) - 1, m2::PointUToUint64(m2::PointU((1 << 30) - 1, (1 << 30) - 1)), ());
-}
-
diff --git a/geometry/pointu_to_uint64.hpp b/geometry/pointu_to_uint64.hpp
deleted file mode 100644
index 3ea17330cf..0000000000
--- a/geometry/pointu_to_uint64.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#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