MCPcopy Create free account
hub / github.com/JACoders/OpenJK / KeywordHash_Key

Function KeywordHash_Key

code/ui/ui_shared.cpp:1221–1234  ·  view source on GitHub ↗

================ KeywordHash_Key ================ */

Source from the content-addressed store, hash-verified

1219================
1220*/
1221int KeywordHash_Key(const char *keyword)
1222{
1223 int hash, i;
1224
1225 hash = 0;
1226 for (i = 0; keyword[i] != '\0'; i++) {
1227 if (keyword[i] >= 'A' && keyword[i] <= 'Z')
1228 hash += (keyword[i] + ('a' - 'A')) * (119 + i);
1229 else
1230 hash += keyword[i] * (119 + i);
1231 }
1232 hash = (hash ^ (hash >> 10) ^ (hash >> 20)) & (KEYWORDHASH_SIZE-1);
1233 return hash;
1234}
1235
1236/*
1237================

Callers 2

KeywordHash_AddFunction · 0.70
KeywordHash_FindFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected