13 Initialize(initial_capacity);
25 if (
p->key !=
nullptr) {
37 if ((occupancy_ + (occupancy_ / 4)) >= capacity_) {
52 if (candidate->
key ==
nullptr) {
71 ASSERT(occupancy_ < capacity_);
79 if (
next == map_end()) {
86 if (
next->key ==
nullptr) {
99 if ((
next > candidate && (start <= candidate || start >
next)) ||
100 (
next < candidate && (start <= candidate && start >
next))) {
107 candidate->
key =
nullptr;
115 if ((clear !=
nullptr) && (
p->key !=
nullptr)) {
124 return Next(map_ - 1);
131 if (
p->key !=
nullptr) {
146 ASSERT(occupancy_ < capacity_);
147 while (
p->key !=
nullptr && (
hash !=
p->hash || !match_(
key,
p->key))) {
157void SimpleHashMap::Initialize(uint32_t capacity) {
164void SimpleHashMap::Resize() {
166 uint32_t n = occupancy_;
169 Initialize(capacity_ * 2);
173 if (
p->key !=
nullptr) {
static float next(float f)
static uint32_t hash(const SkShaderBase::GradientInfo &v)
void Clear(ClearFun clear=nullptr)
Entry * Lookup(void *key, uint32_t hash, bool insert)
void Remove(void *key, uint32_t hash)
intptr_t capacity() const
SimpleHashMap(MatchFun match, uint32_t initial_capacity)
Entry * Next(Entry *p) const
static constexpr bool IsPowerOfTwo(T x)
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>