5#ifndef RUNTIME_PLATFORM_HASHMAP_H_
6#define RUNTIME_PLATFORM_HASHMAP_H_
14 typedef bool (*
MatchFun)(
void* key1,
void* key2);
28 if (
key ==
nullptr)
return hash_;
30 for (
int i = 0;
i <
len;
i++) {
38 return hash_ == 0 ? 1 : hash_;
42 return strcmp(
reinterpret_cast<char*
>(key1),
43 reinterpret_cast<char*
>(key2)) == 0;
74 intptr_t
size()
const {
return occupancy_; }
79 intptr_t
capacity()
const {
return capacity_; }
98 Entry* map_end()
const {
return map_ + capacity_; }
static uint32_t hash(const SkShaderBase::GradientInfo &v)
void Clear(ClearFun clear=nullptr)
static bool SamePointerValue(void *key1, void *key2)
Entry * Lookup(void *key, uint32_t hash, bool insert)
static bool SameStringValue(void *key1, void *key2)
void(* ClearFun)(void *value)
void Remove(void *key, uint32_t hash)
intptr_t capacity() const
SimpleHashMap(MatchFun match, uint32_t initial_capacity)
static uint32_t StringHash(const char *key)
bool(* MatchFun)(void *key1, void *key2)
Entry * Next(Entry *p) const