MCPcopy Create free account
hub / github.com/ddnet/ddnet / CalcHashId

Function CalcHashId

src/engine/shared/snapshot.cpp:181–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

179};
180
181static inline size_t CalcHashId(int Key)
182{
183 // djb2 (http://www.cse.yorku.ca/~oz/hash.html)
184 unsigned Hash = 5381;
185 for(unsigned Shift = 0; Shift < sizeof(int); Shift++)
186 Hash = ((Hash << 5) + Hash) + ((Key >> (Shift * 8)) & 0xFF);
187 return Hash % HASHLIST_SIZE;
188}
189
190static void GenerateHash(CItemList *pHashlist, const CSnapshot *pSnapshot)
191{

Callers 2

GenerateHashFunction · 0.85
GetItemIndexHashedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected