MCPcopy Create free account
hub / github.com/EndstoneMC/endstone / computeHash

Method computeHash

src/bedrock/core/string/string_hash.h:45–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 bool operator!=(const HashedString &other) const;
44
45 static HashType64 computeHash(const std::string &str)
46 {
47 constexpr HashType64 offset_basis = 0xCBF29CE484222325;
48 constexpr HashType64 prime = 0x100000001B3;
49
50 if (str.empty()) {
51 return 0;
52 }
53
54 HashType64 hash = offset_basis;
55 for (char c : str) {
56 hash *= prime;
57 hash ^= static_cast<unsigned char>(c);
58 }
59 return hash;
60 }
61
62 static HashType64 computeHash(const char *str)
63 {

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected