Also tweak the bucket size calculation to be prime for just a bit
longer than.
Change-Id: I9fc6779956693301eb01a6558d4c20d8e39d8bad
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
void remove(PropertyTableEntry *prop)
{
- PropertyTableEntry *bucket = _buckets[prop->hashValue() % _bucketCount];
- if (bucket == prop) {
- bucket = bucket->next;
+ PropertyTableEntry **bucket = _buckets + (prop->hashValue() % _bucketCount);
+ if (*bucket == prop) {
+ *bucket = prop->next;
} else {
- for (PropertyTableEntry *it = bucket; it; it = it->next) {
+ for (PropertyTableEntry *it = *bucket; it; it = it->next) {
if (it->next == prop) {
it->next = it->next->next;
break;
void rehash()
{
if (_bucketCount)
- _bucketCount *= 2; // ### next prime
+ _bucketCount = _bucketCount * 2 + 1; // ### next prime
else
_bucketCount = 11;