From 5f1f6c5941730be4e2a660029cd2600a3d2e2568 Mon Sep 17 00:00:00 2001 From: ahodgkinson Date: Thu, 27 Jul 2006 17:23:47 +0000 Subject: [PATCH] FTK change. The hash mask used by the block allocator is now based on the page size or allocation granularity of the platform. git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@717 0109f412-320b-0410-ab79-c3e0c5ffbbe6 --- ftk/src/ftkcmem.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ftk/src/ftkcmem.cpp b/ftk/src/ftkcmem.cpp index dcc37f9..04063a3 100644 --- a/ftk/src/ftkcmem.cpp +++ b/ftk/src/ftkcmem.cpp @@ -354,7 +354,20 @@ RCODE F_BlockAlloc::setup( // cell address to determine the correct hash SLABINFO // hash bucket - m_uiHashMask = ~((FLMUINT)(m_uiSlabSize - 1)); +#ifdef FLM_WIN + { + SYSTEM_INFO sysInfo; + + GetSystemInfo( &sysInfo); + m_uiHashMask = ~((FLMUINT)(sysInfo.dwAllocationGranularity - 1)); + } +#elif defined( FLM_UNIX) + m_uiHashMask = ~((FLMUINT)(sysconf( _SC_PAGESIZE) - 1)); +#else + m_uiHashMask = FLM_MAX_UINT - 0xFFFF; +#else + +#endif Exit: