MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / ComputeHash

Function ComputeHash

Bcore/src/main/cpp/ziparchive/zip_archive.cc:102–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static uint32_t ComputeHash(const ZipString& name) {
103#if !defined(_WIN32)
104 return std::hash<std::string_view>{}(
105 std::string_view(reinterpret_cast<const char*>(name.name), name.name_length));
106#else
107 // Remove this code path once the windows compiler knows how to compile the above statement.
108 uint32_t hash = 0;
109 uint16_t len = name.name_length;
110 const uint8_t* str = name.name;
111
112 while (len--) {
113 hash = hash * 31 + *str++;
114 }
115
116 return hash;
117#endif
118}
119
120/*
121 * Convert a ZipEntry to a hash table index, verifying that it's in a

Callers 2

EntryToIndexFunction · 0.85
AddToHashFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected