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

Function PC_NameHash

codemp/botlib/l_precomp.cpp:559–572  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

557//char primes[16] = {1, 3, 5, 7, 11, 13, 17, 19, 23, 27, 29, 31, 37, 41, 43, 47};
558
559int PC_NameHash(char *name)
560{
561 int hash, i;
562
563 hash = 0;
564 for (i = 0; name[i] != '\0'; i++)
565 {
566 hash += name[i] * (119 + i);
567 //hash += (name[i] << 7) + i;
568 //hash += (name[i] << (i&15));
569 } //end while
570 hash = (hash ^ (hash >> 10) ^ (hash >> 20)) & (DEFINEHASHSIZE-1);
571 return hash;
572} //end of the function PC_NameHash
573//============================================================================
574//
575// Parameter: -

Callers 3

PC_AddDefineToHashFunction · 0.85
PC_FindHashedDefineFunction · 0.85
PC_Directive_undefFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected