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

Function hashForString

code/ui/ui_shared.cpp:1276–1292  ·  view source on GitHub ↗

================ hashForString return a hash value for the string ================ */

Source from the content-addressed store, hash-verified

1274================
1275*/
1276static unsigned hashForString(const char *str)
1277{
1278 int i;
1279 unsigned hash;
1280 char letter;
1281
1282 hash = 0;
1283 i = 0;
1284 while (str[i] != '\0')
1285 {
1286 letter = tolower((unsigned char)str[i]);
1287 hash += (unsigned)(letter)*(i + 119);
1288 i++;
1289 }
1290 hash &= (HASH_TABLE_SIZE-1);
1291 return hash;
1292}
1293
1294/*
1295=================

Callers 1

String_AllocFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected