aboutsummaryrefslogtreecommitdiff
path: root/src/SBaseCommon.cpp
diff options
context:
space:
mode:
authorLadislav Zezula <ladislav.zezula@avg.com>2016-07-14 14:15:29 +0200
committerLadislav Zezula <ladislav.zezula@avg.com>2016-07-14 14:15:29 +0200
commitf3112547853a361f9c5419cfb6810b2a54c643e6 (patch)
treeef7998fbd7f3d47e564005dd0b173151275329f3 /src/SBaseCommon.cpp
parent7597fe1702e4f27faf51d201b566139e17ad4342 (diff)
+ Fixed bug in opening SQP archives
+ More efficient version of GetNearestPowerOfTwo
Diffstat (limited to 'src/SBaseCommon.cpp')
-rw-r--r--src/SBaseCommon.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/SBaseCommon.cpp b/src/SBaseCommon.cpp
index 5483f55..02dc124 100644
--- a/src/SBaseCommon.cpp
+++ b/src/SBaseCommon.cpp
@@ -257,20 +257,20 @@ DWORD HashStringLower(const char * szFileName, DWORD dwHashType)
// Returns the nearest higher power of two.
// If the value is already a power of two, returns the same value
-//static DWORD GetNearestPowerOfTwo(DWORD dwValue)
-//{
-// dwValue --;
-//
-// dwValue |= dwValue >> 1;
-// dwValue |= dwValue >> 2;
-// dwValue |= dwValue >> 4;
-// dwValue |= dwValue >> 8;
-// dwValue |= dwValue >> 16;
-//
-// return dwValue + 1;
-//}
+DWORD GetNearestPowerOfTwo(DWORD dwFileCount)
+{
+ dwFileCount --;
-DWORD GetHashTableSizeForFileCount(DWORD dwFileCount)
+ dwFileCount |= dwFileCount >> 1;
+ dwFileCount |= dwFileCount >> 2;
+ dwFileCount |= dwFileCount >> 4;
+ dwFileCount |= dwFileCount >> 8;
+ dwFileCount |= dwFileCount >> 16;
+
+ return dwFileCount + 1;
+}
+/*
+DWORD GetNearestPowerOfTwo(DWORD dwFileCount)
{
DWORD dwPowerOfTwo = HASH_TABLE_SIZE_MIN;
@@ -284,7 +284,7 @@ DWORD GetHashTableSizeForFileCount(DWORD dwFileCount)
dwPowerOfTwo <<= 1;
return dwPowerOfTwo;
}
-
+*/
//-----------------------------------------------------------------------------
// Calculates a Jenkin's Encrypting and decrypting MPQ file data