X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bfe1edbddba7ab2ffc59d0d13252dfc03d609bd6..b156929dd096cb0c0c46cd4a5747556dde228675:/include/wx/hashmap.h diff --git a/include/wx/hashmap.h b/include/wx/hashmap.h index ad8005c31c..31280b1f5b 100644 --- a/include/wx/hashmap.h +++ b/include/wx/hashmap.h @@ -337,8 +337,8 @@ protected: \ /* returns NULL if not found */ \ Node** GetNodePtr( const const_key_type& key ) const \ { \ - unsigned long hash = wx_static_cast(unsigned long, m_hasher( key )); \ - Node** node = &m_table[hash % m_tableBuckets]; \ + size_t bucket = m_hasher( key ) % m_tableBuckets; \ + Node** node = &m_table[bucket]; \ \ while( *node ) \ { \ @@ -354,8 +354,8 @@ protected: \ /* expressing it in terms of GetNodePtr is 5-8% slower :-( */ \ Node* GetNode( const const_key_type& key ) const \ { \ - unsigned long hash = wx_static_cast(unsigned long, m_hasher( key )); \ - Node* node = m_table[hash % m_tableBuckets]; \ + size_t bucket = m_hasher( key ) % m_tableBuckets; \ + Node* node = m_table[bucket]; \ \ while( node ) \ { \ @@ -462,11 +462,13 @@ class WXDLLIMPEXP_BASE wxIntegerHash WX_HASH_MAP_NAMESPACE::hash shortHash; WX_HASH_MAP_NAMESPACE::hash ushortHash; +#if defined wxLongLong_t && !defined wxLongLongIsLong size_t longlongHash( wxLongLong_t x ) const { return longHash( wx_truncate_cast(long, x) ) ^ longHash( wx_truncate_cast(long, x >> (sizeof(long) * 8)) ); } +#endif public: wxIntegerHash() { }