From 71cd0199fda68a84c5f9a5252bf63e69712b177b Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 27 Feb 2013 10:01:20 +0000 Subject: 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 --- source/WorldStorage/WSSAnvil.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/WorldStorage/WSSAnvil.cpp') diff --git a/source/WorldStorage/WSSAnvil.cpp b/source/WorldStorage/WSSAnvil.cpp index 1204db282..70e280a57 100644 --- a/source/WorldStorage/WSSAnvil.cpp +++ b/source/WorldStorage/WSSAnvil.cpp @@ -388,9 +388,10 @@ bool cWSSAnvil::SetChunkData(const cChunkCoords & a_Chunk, const AString & a_Dat cWSSAnvil::cMCAFile * cWSSAnvil::LoadMCAFile(const cChunkCoords & a_Chunk) { // ASSUME m_CS is locked + ASSERT(m_CS.IsLocked()); - const int RegionX = (int)(floorf((float)a_Chunk.m_ChunkX / 32.0f)); - const int RegionZ = (int)(floorf((float)a_Chunk.m_ChunkZ / 32.0f)); + const int RegionX = FAST_FLOOR_DIV(a_Chunk.m_ChunkX, 32); + const int RegionZ = FAST_FLOOR_DIV(a_Chunk.m_ChunkZ, 32); // Is it already cached? for (cMCAFiles::iterator itr = m_Files.begin(); itr != m_Files.end(); ++itr) -- cgit v1.2.3