| 114 | } |
| 115 | |
| 116 | void Insert(T value) |
| 117 | { |
| 118 | if (mHashHeads == NULL) |
| 119 | mHashHeads = (Entry**)mAlloc.AllocBytes(sizeof(Entry*) * mHashSize, alignof(Entry*)); |
| 120 | |
| 121 | int hash = GetHash(value->mName); |
| 122 | int hashIdx = hash % mHashSize; |
| 123 | Entry* headEntry = mHashHeads[hashIdx]; |
| 124 | |
| 125 | Entry* newEntry = mAlloc.Alloc<Entry>(); |
| 126 | newEntry->mValue = value; |
| 127 | newEntry->mNext = headEntry; |
| 128 | newEntry->mHash = hash; |
| 129 | mCount++; |
| 130 | |
| 131 | mHashHeads[hashIdx] = newEntry; |
| 132 | } |
| 133 | |
| 134 | void Rehash(int newHashSize) |
| 135 | { |
no test coverage detected