MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / calchash

Function calchash

other_src/lua/src/lstring.cpp:75–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74
75static lua_Hash calchash(const char *str, size_t l) {
76 lua_Hash h = cast(unsigned int, l); /* seed */
77 size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */
78 size_t l1;
79 for (l1=l; l1>=step; l1-=step) { /* compute hash */
80 h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));
81 }
82 return h;
83}
84
85
86LUA_API lua_Hash lua_calchash(const char *str, size_t l) {

Callers 2

lua_calchashFunction · 0.85
luaS_newlstrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected