MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / __ham_func4

Function __ham_func4

tools/comdb2ar/chksum.cpp:55–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55uint32_t __ham_func4(const uint8_t *k, uint32_t len)
56{
57 uint32_t h, loop;
58
59 if (len == 0)
60 return (0);
61
62#define HASH4a h = (h << 5) - h + *k++;
63#define HASH4b h = (h << 5) + h + *k++;
64#define HASH4 HASH4b
65 h = 0;
66
67 loop = (len + 8 - 1) >> 3;
68 switch (len & (8 - 1)) {
69 case 0:
70 do {
71 HASH4;
72 case 7:
73 HASH4;
74 case 6:
75 HASH4;
76 case 5:
77 HASH4;
78 case 4:
79 HASH4;
80 case 3:
81 HASH4;
82 case 2:
83 HASH4;
84 case 1:
85 HASH4;
86 } while (--loop);
87 }
88 return (h);
89}

Callers 2

verify_checksumFunction · 0.70
check_chksumFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected