1
0

Made FAST_FLOOR_DIV work correctly, replaced all floorf() divisions with it.

Still not perfect - chunk and region calculations can be made into a single CPU instruction - SAR - but not all compilers are known to support that (">>" operator on signed datatypes needs to perform arithmetic shift, C/C++ standard makes it implementation-specific; MSVC and GCC do what we need, LLVM unknown)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1224 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2013-02-27 10:01:20 +00:00
parent 24d3d5dac4
commit 71cd0199fd
5 changed files with 14 additions and 12 deletions

View File

@@ -171,8 +171,8 @@ cWSSCompact::cPAKFile * cWSSCompact::LoadPAKFile(const cChunkCoords & a_Chunk)
// ASSUMES that m_CS has been locked
// We need to retain this weird conversion code, because some edge chunks are in the wrong PAK file
const int LayerX = (int)(floorf((float)a_Chunk.m_ChunkX / 32.0f));
const int LayerZ = (int)(floorf((float)a_Chunk.m_ChunkZ / 32.0f));
const int LayerX = FAST_FLOOR_DIV(a_Chunk.m_ChunkX, 32);
const int LayerZ = FAST_FLOOR_DIV(a_Chunk.m_ChunkZ, 32);
// Is it already cached?
for (cPAKFiles::iterator itr = m_PAKFiles.begin(); itr != m_PAKFiles.end(); ++itr)