hash generates a hash value for the given key
(key any)
| 105 | |
| 106 | // hash generates a hash value for the given key |
| 107 | func (hm *HashMap) hash(key any) uint64 { |
| 108 | h := fnv.New64a() |
| 109 | _, _ = h.Write([]byte(fmt.Sprintf("%v", key))) |
| 110 | hashValue := h.Sum64() |
| 111 | return (hm.capacity - 1) & (hashValue ^ (hashValue >> 16)) |
| 112 | } |
no outgoing calls
no test coverage detected