diff options
author | Rafael Reilova <rafael7@users.noreply.github.com> | 2014-11-16 21:52:24 -0500 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2014-11-21 22:33:48 +1000 |
commit | f7d65091f83abe1cb1a70d6823291df8accbe6ab (patch) | |
tree | 6955cb513a7d92e9db775e33e18389dfc2738667 /src/nodetimer.cpp | |
parent | d406ac994b8092c5bd2dc32eda1a2eafbf95a30c (diff) | |
download | minetest-f7d65091f83abe1cb1a70d6823291df8accbe6ab.tar.gz minetest-f7d65091f83abe1cb1a70d6823291df8accbe6ab.tar.bz2 minetest-f7d65091f83abe1cb1a70d6823291df8accbe6ab.zip |
serialize.h: use machine native byte swapping if available, fall-back to previous generic method if not (supported for GCC using endian.h, detection done in cmake) write/readARGB8() - just write 32-bit color in one op, instead of 4 1-byte ops cleanup: removed unneeded buffer init for some serialize-out functions use a #define for the fixed point factor in read/writeF1000()
nodemetadata.cpp, nodetimer.cpp
optimzation: simpler deserialize node position method
staticobject.cpp:
cleanup: use util/serialize.h inlines instead of its own de/serialization
serialize.cpp:
minor optimization/cleanup: avoid generation of unneeded string temporary
CMakeLists.txt, cmake_config.h.in: detection of endian.h
config.h: added HAVE_ENDIAN_H
Commits due to feedback squashed
Signed-off-by: Craig Robbins <kde.psych@gmail.com>
Diffstat (limited to 'src/nodetimer.cpp')
-rw-r--r-- | src/nodetimer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nodetimer.cpp b/src/nodetimer.cpp index 5fc652bb7..d4971c873 100644 --- a/src/nodetimer.cpp +++ b/src/nodetimer.cpp @@ -96,12 +96,12 @@ void NodeTimerList::deSerialize(std::istream &is, u8 map_format_version) { u16 p16 = readU16(is); - v3s16 p(0,0,0); - p.Z += p16 / MAP_BLOCKSIZE / MAP_BLOCKSIZE; - p16 -= p.Z * MAP_BLOCKSIZE * MAP_BLOCKSIZE; - p.Y += p16 / MAP_BLOCKSIZE; - p16 -= p.Y * MAP_BLOCKSIZE; - p.X += p16; + v3s16 p; + p.Z = p16 / MAP_BLOCKSIZE / MAP_BLOCKSIZE; + p16 &= MAP_BLOCKSIZE * MAP_BLOCKSIZE - 1; + p.Y = p16 / MAP_BLOCKSIZE; + p16 &= MAP_BLOCKSIZE - 1; + p.X = p16; NodeTimer t; t.deSerialize(is); |