X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0508ba2a6b5806ce54ba290d9c651d09433e15a9..e34f4f195d204ca8eb94c651f8bed85e1820c368:/src/common/hashmap.cpp?ds=sidebyside diff --git a/src/common/hashmap.cpp b/src/common/hashmap.cpp index fe3628c329..19a385d451 100644 --- a/src/common/hashmap.cpp +++ b/src/common/hashmap.cpp @@ -2,7 +2,7 @@ // Name: hashmap.cpp // Purpose: wxHashMap implementation // Author: Mattia Barbon -// Modified by: +// Modified by: // Created: 29/01/2002 // RCS-ID: $Id$ // Copyright: (c) Mattia Barbon @@ -22,8 +22,6 @@ #include "wx/hashmap.h" -#include - /* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins */ /* from requirements by Colin Plumb. */ /* (http://burtleburtle.net/bob/hash/doobs.html) */ @@ -40,7 +38,7 @@ unsigned long wxStringHash::wxCharStringHash( const wxChar* k ) } hash += (hash << 3); hash ^= (hash >> 11); - + return hash + (hash << 15); } @@ -57,26 +55,26 @@ unsigned long wxStringHash::charStringHash( const char* k ) } hash += (hash << 3); hash ^= (hash >> 11); - + return hash + (hash << 15); } #endif /* from SGI STL */ -const unsigned long _wxHashTableBase2::s_primes[prime_count] = +const unsigned long _wxHashTableBase2::ms_primes[prime_count] = { 7ul, 13ul, 29ul, 53ul, 97ul, 193ul, 389ul, 769ul, 1543ul, 3079ul, 6151ul, 12289ul, 24593ul, 49157ul, 98317ul, 196613ul, 393241ul, 786433ul, 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, - 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, + 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, 1610612741ul, 3221225473ul, 4294967291ul }; unsigned long _wxHashTableBase2::GetNextPrime( unsigned long n ) { - const unsigned long* ptr = &s_primes[0]; + const unsigned long* ptr = &ms_primes[0]; for( size_t i = 0; i < prime_count; ++i, ++ptr ) { if( n < *ptr ) @@ -84,14 +82,15 @@ unsigned long _wxHashTableBase2::GetNextPrime( unsigned long n ) } /* someone might try to alloc a 2^32-element hash table */ - assert(0); + wxFAIL_MSG( _T("hash table too big?") ); + /* quiet warning */ return 0; } unsigned long _wxHashTableBase2::GetPreviousPrime( unsigned long n ) { - const unsigned long* ptr = &s_primes[prime_count - 1]; + const unsigned long* ptr = &ms_primes[prime_count - 1]; for( size_t i = 0; i < prime_count; ++i, --ptr ) { @@ -134,7 +133,7 @@ void _wxHashTableBase2::CopyHashTable( _wxHashTable_NodeBase** srcTable, for( size_t i = 0; i < srcBuckets; ++i ) { _wxHashTable_NodeBase* nextnode; - + for( _wxHashTable_NodeBase* node = srcTable[i]; node; node = nextnode ) { size_t bucket = func( dst, node );