From 0730ca640b095662a918fa55486c7b5bc4eba31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Fri, 21 Mar 2014 13:32:03 +0100 Subject: [PATCH] get rid of float division --- src/map/tile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/map/tile.cpp b/src/map/tile.cpp index e619c32bf..6ec05beca 100644 --- a/src/map/tile.cpp +++ b/src/map/tile.cpp @@ -12,9 +12,9 @@ Tile::ID Tile::ID::parent(int8_t parent_z) const { assert(parent_z < z); int32_t dim = pow(2, z - parent_z); return Tile::ID{ - static_cast(parent_z), - static_cast(floor((float)x / dim)), - static_cast(y / dim) + parent_z, + (x >= 0 ? x : x - dim + 1) / dim, + y / dim }; }