1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-23 16:08:51 -05:00

Use bit shifts rather than multiplication in block position encoding

This commit is contained in:
ShadowNinja 2014-04-15 16:25:04 -04:00
parent 54ffe2e5de
commit a2003b0d55

View File

@ -32,9 +32,9 @@ static inline s16 unsigned_to_signed(u16 i, u16 max_positive)
s64 Database::getBlockAsInteger(const v3s16 pos) const s64 Database::getBlockAsInteger(const v3s16 pos) const
{ {
return (u64) pos.Z * 0x1000000 + return (((u64) pos.Z) << 24) +
(u64) pos.Y * 0x1000 + (((u64) pos.Y) << 12) +
(u64) pos.X; ((u64) pos.X);
} }
v3s16 Database::getIntegerAsBlock(const s64 i) const v3s16 Database::getIntegerAsBlock(const s64 i) const