| Index: src/base/hashmap.h
|
| diff --git a/src/base/hashmap.h b/src/base/hashmap.h
|
| index 54038c5ef350d00423b0d36607e964b96b77a9bc..d2fc1337a646e77cd833bce3c6881aeb59e25f01 100644
|
| --- a/src/base/hashmap.h
|
| +++ b/src/base/hashmap.h
|
| @@ -229,9 +229,8 @@ template <typename Key, typename Value, typename MatchFun,
|
| class AllocationPolicy>
|
| void TemplateHashMapImpl<Key, Value, MatchFun, AllocationPolicy>::Clear() {
|
| // Mark all entries as empty.
|
| - const Entry* end = map_end();
|
| - for (Entry* entry = map_; entry < end; entry++) {
|
| - entry->clear();
|
| + for (size_t i = 0; i < capacity_; ++i) {
|
| + map_[i].clear();
|
| }
|
| occupancy_ = 0;
|
| }
|
| @@ -264,19 +263,15 @@ typename TemplateHashMapImpl<Key, Value, MatchFun, AllocationPolicy>::Entry*
|
| TemplateHashMapImpl<Key, Value, MatchFun, AllocationPolicy>::Probe(
|
| const Key& key, uint32_t hash) const {
|
| DCHECK(base::bits::IsPowerOfTwo32(capacity_));
|
| - Entry* entry = map_ + (hash & (capacity_ - 1));
|
| - const Entry* end = map_end();
|
| - DCHECK(map_ <= entry && entry < end);
|
| + size_t i = hash & (capacity_ - 1);
|
| + DCHECK(i < capacity_);
|
|
|
| DCHECK(occupancy_ < capacity_); // Guarantees loop termination.
|
| - while (entry->exists() && !match_(hash, entry->hash, key, entry->key)) {
|
| - entry++;
|
| - if (entry >= end) {
|
| - entry = map_;
|
| - }
|
| + while (map_[i].exists() && !match_(hash, map_[i].hash, key, map_[i].key)) {
|
| + i = (i + 1) & (capacity_ - 1);
|
| }
|
|
|
| - return entry;
|
| + return &map_[i];
|
| }
|
|
|
| template <typename Key, typename Value, typename MatchFun,
|
|
|