Browse Source

base: fix map.h build.

legacy
Sam Hocevar sam 11 years ago
parent
commit
85ef683cce
1 changed files with 10 additions and 3 deletions
  1. +10
    -3
      src/lol/base/map.h

+ 10
- 3
src/lol/base/map.h View File

@@ -43,7 +43,8 @@ public:
inline V & operator[] (E const &key)
{
/* Look for the hash in our table and return the value if found. */
int i = FindIndex(key);
uint32_t hash = ((Hash<K> const &)*this)(key);
int i = FindIndex(key, hash);
if (i >= 0)
return m_array[i].m3;

@@ -86,9 +87,8 @@ public:

private:
template <typename E>
int FindIndex(E const &key)
inline int FindIndex(E const &key, uint32_t hash)
{
uint32_t hash = ((Hash<K> const &)*this)(key);
for (int i = 0; i < m_array.Count(); ++i)
if (m_array[i].m1 == hash)
if (m_array[i].m2 == key)
@@ -96,6 +96,13 @@ private:
return -1;
}

template <typename E>
inline int FindIndex(E const &key)
{
uint32_t hash = ((Hash<K> const &)*this)(key);
return FindIndex(key, hash);
}

Array<uint32_t, K, V> m_array;
};



Loading…
Cancel
Save