MCPcopy
hub / github.com/klauspost/compress / hash4

Function hash4

s2/encode_better.go:16–19  ·  view source on GitHub ↗

hash4 returns the hash of the lowest 4 bytes of u to fit in a hash table with h bits. Preferably h should be a constant and should always be <32.

(u uint64, h uint8)

Source from the content-addressed store, hash-verified

14// hash4 returns the hash of the lowest 4 bytes of u to fit in a hash table with h bits.
15// Preferably h should be a constant and should always be <32.
16func hash4(u uint64, h uint8) uint32 {
17 const prime4bytes = 2654435761
18 return (uint32(u) * prime4bytes) >> ((32 - h) & 31)
19}
20
21// hash5 returns the hash of the lowest 5 bytes of u to fit in a hash table with h bits.
22// Preferably h should be a constant and should always be <64.

Callers 9

encodeBlockBetterGoFunction · 0.70
encodeBlockBetterGo64KFunction · 0.70
encodeBlockBetterDictFunction · 0.70
encodeBlockBestFunction · 0.70
encodeBlockBestSnappyFunction · 0.70
initBetterMethod · 0.70
initBestMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…