MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / hash

Method hash

core/string/ustring.cpp:2718–2729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2716}
2717
2718uint32_t String::hash(const char *p_cstr) {
2719 // static_cast: avoid negative values on platforms where char is signed.
2720 uint32_t hashv = 5381;
2721 uint32_t c = static_cast<uint8_t>(*p_cstr++);
2722
2723 while (c) {
2724 hashv = ((hashv << 5) + hashv) + c; /* hash * 33 + c */
2725 c = static_cast<uint8_t>(*p_cstr++);
2726 }
2727
2728 return hashv;
2729}
2730
2731uint32_t String::hash(const char *p_cstr, int p_len) {
2732 uint32_t hashv = 5381;

Callers 2

_update_hash_cacheMethod · 0.45
StringNameMethod · 0.45

Calls 1

get_dataFunction · 0.85

Tested by

no test coverage detected