diff options
author | erwincoumans <erwin.coumans@gmail.com> | 2018-06-05 09:16:00 -0700 |
---|---|---|
committer | erwincoumans <erwin.coumans@gmail.com> | 2018-06-05 09:16:00 -0700 |
commit | fa648a028ec01b8d4fe80d865afc76cbf7e58a5d (patch) | |
tree | 70cb75aeb3a11558b34c77af2bbbfa362af239a2 /src/LinearMath/btHashMap.h | |
parent | d7cbe8dd267de293f08d62c140953229257786ab (diff) | |
download | bullet3-fa648a028ec01b8d4fe80d865afc76cbf7e58a5d.tar.gz |
fix a few problems introduced in #1730
https://github.com/bulletphysics/bullet3/pull/1730
Diffstat (limited to 'src/LinearMath/btHashMap.h')
-rw-r--r-- | src/LinearMath/btHashMap.h | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/LinearMath/btHashMap.h b/src/LinearMath/btHashMap.h index 7965c11f6..180e7b44a 100644 --- a/src/LinearMath/btHashMap.h +++ b/src/LinearMath/btHashMap.h @@ -23,7 +23,7 @@ subject to the following restrictions: ///very basic hashable string implementation, compatible with btHashMap struct btHashString { - std::string m_string; + std::string m_string1; unsigned int m_hash; SIMD_FORCE_INLINE unsigned int getHash()const @@ -33,11 +33,11 @@ struct btHashString btHashString() { - m_string=""; + m_string1=""; m_hash=0; } btHashString(const char* name) - :m_string(name) + :m_string1(name) { /* magic numbers from http://www.isthe.com/chongo/tech/comp/fnv/ */ static const unsigned int InitialFNV = 2166136261u; @@ -46,36 +46,18 @@ struct btHashString /* Fowler / Noll / Vo (FNV) Hash */ unsigned int hash = InitialFNV; - for(int i = 0; m_string[i]; i++) + for(int i = 0; m_string1.c_str()[i]; i++) { - hash = hash ^ (m_string[i]); /* xor the low 8 bits */ + hash = hash ^ (m_string1.c_str()[i]); /* xor the low 8 bits */ hash = hash * FNVMultiple; /* multiply by the magic number */ } m_hash = hash; } - int portableStringCompare(const char* src, const char* dst) const - { - int ret = 0 ; - - while( ! (ret = *(const unsigned char *)src - *(const unsigned char *)dst) && *dst) - ++src, ++dst; - - if ( ret < 0 ) - ret = -1 ; - else if ( ret > 0 ) - ret = 1 ; - - return( ret ); - } - bool equals(const btHashString& other) const { - return (m_string == other.m_string) || - (0==portableStringCompare(m_string.c_str(),other.m_string.c_str())); - + return (m_string1 == other.m_string1); } - }; const int BT_HASH_NULL=0xffffffff; |