#include <hashmap.h>
Definition at line 12 of file hashmap.h.
◆ ClearFun
typedef void(* dart::SimpleHashMap::ClearFun) (void *value) |
◆ MatchFun
typedef bool(* dart::SimpleHashMap::MatchFun) (void *key1, void *key2) |
◆ SimpleHashMap()
dart::SimpleHashMap::SimpleHashMap |
( |
MatchFun |
match, |
|
|
uint32_t |
initial_capacity |
|
) |
| |
Definition at line 11 of file hashmap.cc.
11 {
13 Initialize(initial_capacity);
14}
◆ ~SimpleHashMap()
dart::SimpleHashMap::~SimpleHashMap |
( |
| ) |
|
Definition at line 16 of file hashmap.cc.
16 {
17 delete[] map_;
18}
◆ capacity()
intptr_t dart::SimpleHashMap::capacity |
( |
| ) |
const |
|
inline |
◆ Clear()
void dart::SimpleHashMap::Clear |
( |
ClearFun |
clear = nullptr | ) |
|
Definition at line 111 of file hashmap.cc.
111 {
112
115 if ((clear !=
nullptr) && (
p->key !=
nullptr)) {
117 }
119 }
120 occupancy_ = 0;
121}
◆ Lookup()
Definition at line 20 of file hashmap.cc.
22 {
23
25 if (
p->key !=
nullptr) {
27 }
28
29
30 if (insert) {
34 occupancy_++;
35
36
37 if ((occupancy_ + (occupancy_ / 4)) >= capacity_) {
38 Resize();
40 }
41
43 }
44
45
46 return nullptr;
47}
static uint32_t hash(const SkShaderBase::GradientInfo &v)
◆ Next()
Definition at line 127 of file hashmap.cc.
127 {
131 if (
p->key !=
nullptr) {
133 }
134 }
135 return nullptr;
136}
◆ Remove()
void dart::SimpleHashMap::Remove |
( |
void * |
key, |
|
|
uint32_t |
hash |
|
) |
| |
Definition at line 49 of file hashmap.cc.
49 {
50
52 if (candidate->key == nullptr) {
53
54 return;
55 }
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71 ASSERT(occupancy_ < capacity_);
72
73
74
76 while (true) {
77
79 if (
next == map_end()) {
81 }
82
83
84
85
86 if (
next->key ==
nullptr) {
87 break;
88 }
89
90
91
92
94
95
96
97
98
99 if ((
next > candidate && (start <= candidate || start >
next)) ||
100 (
next < candidate && (start <= candidate && start >
next))) {
103 }
104 }
105
106
107 candidate->key = nullptr;
108 occupancy_--;
109}
static float next(float f)
◆ SamePointerValue()
static bool dart::SimpleHashMap::SamePointerValue |
( |
void * |
key1, |
|
|
void * |
key2 |
|
) |
| |
|
inlinestatic |
Definition at line 24 of file hashmap.h.
24{ return key1 == key2; }
◆ SameStringValue()
static bool dart::SimpleHashMap::SameStringValue |
( |
void * |
key1, |
|
|
void * |
key2 |
|
) |
| |
|
inlinestatic |
Definition at line 41 of file hashmap.h.
41 {
42 return strcmp(reinterpret_cast<char*>(key1),
43 reinterpret_cast<char*>(key2)) == 0;
44 }
◆ size()
intptr_t dart::SimpleHashMap::size |
( |
| ) |
const |
|
inline |
◆ Start()
Definition at line 123 of file hashmap.cc.
123 {
124 return Next(map_ - 1);
125}
Entry * Next(Entry *p) const
◆ StringHash()
static uint32_t dart::SimpleHashMap::StringHash |
( |
const char * |
key | ) |
|
|
inlinestatic |
Definition at line 26 of file hashmap.h.
26 {
27 uint32_t hash_ = 0;
28 if (
key ==
nullptr)
return hash_;
30 for (
int i = 0;
i <
len;
i++) {
32 hash_ += hash_ << 10;
33 hash_ ^= hash_ >> 6;
34 }
35 hash_ += hash_ << 3;
36 hash_ ^= hash_ >> 11;
37 hash_ += hash_ << 15;
38 return hash_ == 0 ? 1 : hash_;
39 }
◆ IntSet
The documentation for this class was generated from the following files:
- third_party/dart-lang/sdk/runtime/platform/hashmap.h
- third_party/dart-lang/sdk/runtime/platform/hashmap.cc