projects
/
zefram
/
minetest
/
minetest_engine.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
54ffe2e
)
Use bit shifts rather than multiplication in block position encoding
author
ShadowNinja
<shadowninja@minetest.net>
Tue, 15 Apr 2014 20:25:04 +0000
(16:25 -0400)
committer
ShadowNinja
<shadowninja@minetest.net>
Tue, 15 Apr 2014 20:25:46 +0000
(16:25 -0400)
src/database.cpp
patch
|
blob
|
history
diff --git
a/src/database.cpp
b/src/database.cpp
index cf208be8dc0708212ca3444154ac6467368af43f..15579a7f094955bee32292f11969578c2e428d91 100644
(file)
--- 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