Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PLATFORM_HASHMAP_H_ | 5 #ifndef PLATFORM_HASHMAP_H_ |
| 6 #define PLATFORM_HASHMAP_H_ | 6 #define PLATFORM_HASHMAP_H_ |
| 7 | 7 |
| 8 #include "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 namespace dart { | |
|
Ivan Posva
2013/04/30 15:07:53
We should NOT pollute the dart namespace from outs
tfarina
2013/04/30 16:31:03
What is your argument about leaving it in the glob
| |
| 11 | |
| 10 class HashMap { | 12 class HashMap { |
| 11 public: | 13 public: |
| 12 typedef bool (*MatchFun) (void* key1, void* key2); | 14 typedef bool (*MatchFun) (void* key1, void* key2); |
| 13 | 15 |
| 14 static bool SamePointerValue(void* key1, void* key2) { | 16 static bool SamePointerValue(void* key1, void* key2) { |
| 15 return key1 == key2; | 17 return key1 == key2; |
| 16 } | 18 } |
| 17 | 19 |
| 18 // initial_capacity is the size of the initial hash map; | 20 // initial_capacity is the size of the initial hash map; |
| 19 // it must be a power of 2 (and thus must not be 0). | 21 // it must be a power of 2 (and thus must not be 0). |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 uint32_t occupancy_; | 68 uint32_t occupancy_; |
| 67 | 69 |
| 68 Entry* map_end() const { return map_ + capacity_; } | 70 Entry* map_end() const { return map_ + capacity_; } |
| 69 Entry* Probe(void* key, uint32_t hash); | 71 Entry* Probe(void* key, uint32_t hash); |
| 70 void Initialize(uint32_t capacity); | 72 void Initialize(uint32_t capacity); |
| 71 void Resize(); | 73 void Resize(); |
| 72 | 74 |
| 73 friend class IntSet; // From hashmap_test.cc | 75 friend class IntSet; // From hashmap_test.cc |
| 74 }; | 76 }; |
| 75 | 77 |
| 78 } // namespace dart | |
| 79 | |
| 76 #endif // PLATFORM_HASHMAP_H_ | 80 #endif // PLATFORM_HASHMAP_H_ |
| OLD | NEW |