mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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>
This commit is contained in:
parent
d406ac994b
commit
f7d65091f8
8 changed files with 115 additions and 85 deletions
|
@ -130,12 +130,12 @@ void NodeMetadataList::deSerialize(std::istream &is, IGameDef *gamedef)
|
|||
{
|
||||
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;
|
||||
|
||||
if(m_data.find(p) != m_data.end())
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue