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_;
29 int len = strlen(
key);
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_; }
90 Entry*
Next(Entry* p)
const;
98 Entry* map_end()
const {
return map_ + capacity_; }
99 Entry* Probe(
void*
key, uint32_t
hash);
static bool match(const char *needle, const char *haystack)
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
static uint32_t StringHash(const char *key)
bool(* MatchFun)(void *key1, void *key2)
Entry * Next(Entry *p) const