From f46680ed34366ddf10525e59bf55993738594d4b Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Wed, 20 Sep 2023 13:27:42 -0700 Subject: [PATCH] *Actually* reduce the size of the structure --- tile.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tile.cpp b/tile.cpp index 264117024..4584c316a 100644 --- a/tile.cpp +++ b/tile.cpp @@ -1296,17 +1296,20 @@ long long choose_minextent(std::vector &extents, double f) { struct joint { long long x : 34; // enough to wrap around the world either way - long long y : 33; // enough to touch the top and bottom of the world + unsigned long long p1 : 64 - 34; - unsigned long long p1p2 : 61; + long long y : 33; // enough to touch the top and bottom of the world + unsigned long long p2 : 64 - 34; joint(draw one, draw hinge, draw two) { if (one < two) { std::swap(one, two); } - long long coord[4] = {one.x, one.y, two.x, two.y}; - p1p2 = fnv1a(std::string((const char *) &coord, sizeof(coord))); + long long coord1[2] = {one.x, one.y}; + long long coord2[2] = {two.x, two.y}; + p1 = fnv1a(std::string((const char *) &coord1, sizeof(coord1))); + p2 = fnv1a(std::string((const char *) &coord2, sizeof(coord2))); x = hinge.x; y = hinge.y; @@ -1319,8 +1322,12 @@ struct joint { if (x < o.x) { return true; } else if (x == o.x) { - if (p1p2 < o.p1p2) { + if (p1 < o.p1) { return true; + } else if (p1 == o.p1) { + if (p2 < o.p2) { + return true; + } } } } @@ -2436,7 +2443,8 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch for (size_t i = 0; i + 1 < shared_joints.size(); i++) { if (shared_joints[i].x == shared_joints[i + 1].x && shared_joints[i].y == shared_joints[i + 1].y) { - if (shared_joints[i].p1p2 != shared_joints[i + 1].p1p2) { + if (shared_joints[i].p1 != shared_joints[i + 1].p1 || + shared_joints[i].p2 != shared_joints[i + 1].p2) { shared_nodes.push_back(draw(VT_MOVETO, shared_joints[i].x, shared_joints[i].y)); } }