diff --git a/Project/FastDict.h b/Project/FastDict.h index 5932a87..1dd03ee 100644 --- a/Project/FastDict.h +++ b/Project/FastDict.h @@ -218,13 +218,15 @@ class FastDict { if (m_count > 0) { + int32_t i = 0; + //重置所有储槽 - for (int32_t i = 0; i < m_capacity; i++) + for (i = 0; i < m_capacity; i++) { m_buckets[i] = -1; } //清除项目数据 - for (int32_t i = 0; i < m_count; i++) + for (i = 0; i < m_count; i++) { VariantClear(&m_items[i].key); VariantClear(&m_items[i].value); @@ -848,14 +850,24 @@ class FastDict //取得新扩字节数 int32_t newCapacity = HashHelpers::ExpandPrime(m_capacity);//新扩容量 int32_t blocks = sizeof(int32_t) + sizeof(dicitem); //每个储槽和项目占用的字节数 - DWORDLONG newSize = blocks * (DWORDLONG)newCapacity;//字节数 + #if (_MSC_VER <= 1200) //VC++ 6.0 + int64_t newSize = blocks * (int64_t)newCapacity;//字节数 + #else + uint64_t newSize = blocks * (uint64_t)newCapacity;//字节数 + #endif //取得内存可用空间 MEMORYSTATUSEX ms; ms.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&ms); - DWORDLONG ullAvailPhys = ms.ullAvailPhys; //字节数 - DWORDLONG ullAvailVirtual = ms.ullAvailVirtual; //字节数 + + #if (_MSC_VER <= 1200) //VC++ 6.0 + int64_t ullAvailPhys = (int64_t)ms.ullAvailPhys; //字节数 + int64_t ullAvailVirtual = (int64_t)ms.ullAvailVirtual; //字节数 + #else + uint64_t ullAvailPhys = (uint64_t)ms.ullAvailPhys; //字节数 + uint64_t ullAvailVirtual = (uint64_t)ms.ullAvailVirtual; //字节数 + #endif //已经超出了可用的虚拟内存,但还没有超过可用的物理内存,按可用虚拟内存的50%申请内存 if (newSize >= ullAvailVirtual && newSize < ullAvailPhys) diff --git a/Project/HashHelpers.h b/Project/HashHelpers.h index 33dddf6..38af655 100644 --- a/Project/HashHelpers.h +++ b/Project/HashHelpers.h @@ -20,15 +20,22 @@ //类型定义 #if defined(_MSC_VER) && (_MSC_VER < 1600) - typedef signed char int8_t; - typedef short int16_t; - typedef int int32_t; - typedef long long int64_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - typedef unsigned long long uint64_t; - typedef unsigned __int64 uint64_t; + typedef signed char int8_t; + typedef short int16_t; + typedef int int32_t; + #if (_MSC_VER <= 1200) //VC++ 6.0 + typedef __int64 int64_t; + #else + typedef long long int64_t; + #endif + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #if (_MSC_VER <= 1200) //VC++ 6.0 + typedef unsigned __int64 uint64_t; + #else + typedef unsigned long long uint64_t; + #endif #else #include #endif @@ -121,11 +128,13 @@ class HashHelpers //获得素数 static __forceinline int GetPrime(int min) { + int32_t i = 0; + //获得数组元素的数量 int32_t count = (sizeof(primes) / sizeof(primes[0])); - + //未设置(0),则从primes表中取出一个 >= min的最小素数 - for (int32_t i = 0; i < count; i++) + for (i = 0; i < count; i++) { int prime = primes[i]; if (prime >= min) return prime; @@ -133,7 +142,7 @@ class HashHelpers //超出primes的最大值,则运算一个 //outside of our predefined table. compute the hard way. - for (int32_t i = (min | 1); i < MaxHashTable; i += 2) + for (i = (min | 1); i < MaxHashTable; i += 2) { if (IsPrime(i) && ((i - 1) % DefaultHashPrime != 0)) return i; diff --git a/Project/ReleaseMinDependency/TFastDict-xp.dll b/Project/ReleaseMinDependency/TFastDict-xp.dll new file mode 100644 index 0000000..b51c590 Binary files /dev/null and b/Project/ReleaseMinDependency/TFastDict-xp.dll differ diff --git a/Project/TFastDict.dsp b/Project/TFastDict.dsp index 2efb492..e62abfa 100644 --- a/Project/TFastDict.dsp +++ b/Project/TFastDict.dsp @@ -234,7 +234,7 @@ SOURCE="$(InputPath)" # PROP Intermediate_Dir "ReleaseUMinDependency" # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /FR /Yu"stdafx.h" /FD /c # ADD BASE RSC /l 0x804 /d "NDEBUG" # ADD RSC /l 0x804 /d "NDEBUG" BSC32=bscmake.exe @@ -276,22 +276,6 @@ SOURCE="$(InputPath)" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=.\MemDC.cpp -# End Source File -# Begin Source File - -SOURCE=.\ShadowWindow.cpp -# End Source File -# Begin Source File - -SOURCE=.\FastDict.cpp -# End Source File -# Begin Source File - -SOURCE=.\SkinWindow.cpp -# End Source File -# Begin Source File - SOURCE=.\StdAfx.cpp # ADD CPP /Yc"stdafx.h" # End Source File @@ -314,7 +298,7 @@ SOURCE=.\TFastDict.rc # End Source File # Begin Source File -SOURCE=.\win32gdi.cpp +SOURCE=.\TFastDictInt.cpp # End Source File # End Group # Begin Group "Header Files" @@ -322,31 +306,31 @@ SOURCE=.\win32gdi.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File -SOURCE=.\MemDC.h +SOURCE=.\FastDict.h # End Source File # Begin Source File -SOURCE=.\Resource.h +SOURCE=.\HashHelpers.h # End Source File # Begin Source File -SOURCE=.\ShadowWindow.h +SOURCE=.\Resource.h # End Source File # Begin Source File -SOURCE=.\FastDict.h +SOURCE=.\StdAfx.h # End Source File # Begin Source File -SOURCE=.\SkinWindow.h +SOURCE=.\TFastDict.h # End Source File # Begin Source File -SOURCE=.\StdAfx.h +SOURCE=.\TFastDictInt.h # End Source File # Begin Source File -SOURCE=.\win32gdi.h +SOURCE=.\VMemAlloc.h # End Source File # End Group # Begin Group "Resource Files" @@ -354,7 +338,7 @@ SOURCE=.\win32gdi.h # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # Begin Source File -SOURCE=.\FastDict.rgs +SOURCE=.\TFastDict.rgs # End Source File # End Group # End Target diff --git a/Project/TFastDict2005.vcproj b/Project/TFastDict2005.vcproj index 4c21ef7..c9fe9ca 100644 --- a/Project/TFastDict2005.vcproj +++ b/Project/TFastDict2005.vcproj @@ -862,10 +862,6 @@ Name="Header Files" Filter="h;hpp;hxx;hm;inl" > - - diff --git a/Test/vbpTest.vbw b/Test/vbpTest.vbw index 2493270..1c6fe5d 100644 --- a/Test/vbpTest.vbw +++ b/Test/vbpTest.vbw @@ -1,3 +1,3 @@ -frmMain = 155, 155, 838, 529, Z, 132, 132, 817, 501, C +frmMain = 155, 155, 838, 529, , 132, 132, 817, 501, C cTiming = 78, 78, 842, 517, modMain = 0, 0, 0, 0, C