MCPcopy Create free account
hub / github.com/NetHack/NetHack / glyph_hash

Function glyph_hash

src/glyphs.c:434–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434staticfn uint32
435glyph_hash(const char *id)
436{
437 uint32 hash = 0;
438 size_t i;
439
440 for (i = 0; id[i] != '\0'; ++i) {
441 char ch = id[i];
442 if ('A' <= ch && ch <= 'Z') {
443 ch += 'a' - 'A';
444 }
445 hash = (hash << 1) | (hash >> 31);
446 hash ^= ch;
447 }
448 return hash;
449}
450
451boolean
452glyphid_cache_status(void)

Callers 2

add_glyph_to_cacheFunction · 0.85
find_glyph_in_cacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected