summaryrefslogtreecommitdiff
path: root/src/database.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-04-15 16:25:04 -0400
committerShadowNinja <shadowninja@minetest.net>2014-04-15 16:25:46 -0400
commita2003b0d553c7223a61c75e5dad79ea68e058ba2 (patch)
treec9c342b0394147673046c4d3d771a533fe597303 /src/database.cpp
parent54ffe2e5de9ce44129f84f4748743f893b75fda7 (diff)
downloadminetest-a2003b0d553c7223a61c75e5dad79ea68e058ba2.tar.gz
minetest-a2003b0d553c7223a61c75e5dad79ea68e058ba2.tar.bz2
minetest-a2003b0d553c7223a61c75e5dad79ea68e058ba2.zip
Use bit shifts rather than multiplication in block position encoding
Diffstat (limited to 'src/database.cpp')
-rw-r--r--src/database.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database.cpp b/src/database.cpp
index cf208be8d..15579a7f0 100644
--- a/src/database.cpp
+++ b/src/database.cpp
@@ -32,9 +32,9 @@ static inline s16 unsigned_to_signed(u16 i, u16 max_positive)
s64 Database::getBlockAsInteger(const v3s16 pos) const
{
- return (u64) pos.Z * 0x1000000 +
- (u64) pos.Y * 0x1000 +
- (u64) pos.X;
+ return (((u64) pos.Z) << 24) +
+ (((u64) pos.Y) << 12) +
+ ((u64) pos.X);
}
v3s16 Database::getIntegerAsBlock(const s64 i) const