MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / hash

Method hash

src/dictionary.cpp:70–76  ·  view source on GitHub ↗

Many popular symbols are quite short, e.g. "[B", "()V" etc. FNV-1a is reasonably fast and sufficiently random.

Source from the content-addressed store, hash-verified

68// Many popular symbols are quite short, e.g. "[B", "()V" etc.
69// FNV-1a is reasonably fast and sufficiently random.
70unsigned int Dictionary::hash(const char* key, size_t length) {
71 unsigned int h = 2166136261U;
72 for (size_t i = 0; i < length; i++) {
73 h = (h ^ key[i]) * 16777619;
74 }
75 return h;
76}
77
78unsigned int Dictionary::lookup(const char* key) {
79 return lookup(key, strlen(key));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected