| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #ifndef SRC_VM_PRIORITY_HEAP_H_ | 5 #ifndef SRC_VM_PRIORITY_HEAP_H_ |
| 6 #define SRC_VM_PRIORITY_HEAP_H_ | 6 #define SRC_VM_PRIORITY_HEAP_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "src/shared/assert.h" | 10 #include "src/shared/assert.h" |
| 11 #include "src/vm/hash_map.h" | 11 #include "src/vm/hash_map.h" |
| 12 | 12 |
| 13 namespace fletch { | 13 namespace dartino { |
| 14 | 14 |
| 15 template <typename P, typename V> | 15 template <typename P, typename V> |
| 16 class PriorityHeapWithValueIndex { | 16 class PriorityHeapWithValueIndex { |
| 17 public: | 17 public: |
| 18 static const int kMinimumSize = 16; | 18 static const int kMinimumSize = 16; |
| 19 | 19 |
| 20 typedef struct { | 20 typedef struct { |
| 21 P priority; | 21 P priority; |
| 22 V value; | 22 V value; |
| 23 } Entry; | 23 } Entry; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 backing_ = new_backing; | 200 backing_ = new_backing; |
| 201 backing_size_ = new_backing_size; | 201 backing_size_ = new_backing_size; |
| 202 } | 202 } |
| 203 | 203 |
| 204 Entry* backing_; | 204 Entry* backing_; |
| 205 int backing_size_; | 205 int backing_size_; |
| 206 int size_; | 206 int size_; |
| 207 HashMap<V, int> hashmap_; | 207 HashMap<V, int> hashmap_; |
| 208 }; | 208 }; |
| 209 | 209 |
| 210 } // namespace fletch | 210 } // namespace dartino |
| 211 | 211 |
| 212 #endif // SRC_VM_PRIORITY_HEAP_H_ | 212 #endif // SRC_VM_PRIORITY_HEAP_H_ |
| OLD | NEW |