102 typedef typename TraitsType::KeyTypeConstRef KeyTypeConstRef;
103 typedef typename TraitsType::KeyTypeValue KeyTypeValue;
156 KeyType hf = _hash(
id);
157 for (
HashData* i = m_buckets[hf]; i; i = i->m_next) {
172 void resize(Integer new_table_size,
bool use_prime =
false)
175 if (new_table_size == 0) {
183 m_buckets.resize(new_table_size);
185 for (Integer z = 0, zs = old_buckets.
size(); z < zs; ++z) {
186 for (
HashData* i = old_buckets[z]; i; i = i->m_next) {
187 _baseAdd(_hash(i->m_key), i->m_key, i);
199 for (Integer z = 0, zs = old_buckets.
size(); z < zs; ++z) {
200 for (
HashData* i = old_buckets[z]; i;) {
203 _baseAdd(_hash(current->
m_key), current->
m_key, current);
210 inline Integer _hash(KeyTypeConstRef
id)
const
214 inline HashData* _baseLookupBucket(Integer bucket, KeyTypeConstRef
id)
const
216 for (HashData* i = m_buckets[bucket]; i; i = i->m_next) {
222 inline HashData* _baseRemoveBucket(Integer bucket, KeyTypeConstRef
id)
224 HashData* i = m_buckets[bucket];
226 if (i->m_key ==
id) {
227 m_buckets[bucket] = i->m_next;
231 for (; i->m_next; i = i->m_next) {
232 if (i->m_next->m_key ==
id) {
233 HashData* r = i->m_next;
234 i->m_next = i->m_next->m_next;
242 inline HashData* _baseLookup(KeyTypeConstRef
id)
const
244 return _baseLookupBucket(_hash(
id),
id);
246 inline HashData* _baseRemove(KeyTypeConstRef
id)
248 return _baseRemoveBucket(_hash(
id),
id);
250 inline void _baseAdd(Integer bucket, KeyTypeConstRef
id, HashData* hd)
252 HashData* buck = m_buckets[bucket];
255 m_buckets[bucket] = hd;
261 UniqueArray<HashData*> m_buckets;