MCPcopy Create free account
hub / github.com/Singular/Singular / Hash

Function Hash

ppcc/adlib/hash.cc:8–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#define DJB2_ITER(h, x) ((h * 33) + x)
7
8Word Hash(const char *addr, Int n) {
9 Word hash = DJB2_INIT;
10 while (n-- > 0) {
11 Byte byte = (Byte)(*addr++);
12 hash = DJB2_ITER(hash, byte);
13 }
14 return hash;
15}
16
17Word Hash(const char *str) {
18 Word hash = DJB2_INIT;

Callers 1

MainFunction · 0.70

Calls 2

c_strMethod · 0.80
lenMethod · 0.45

Tested by 1

MainFunction · 0.56