hashAdd adds a string to a fnv64a hash value, returning the updated hash. Note this is the same algorithm as Go stdlib `sum64a.Write()`
(h uint64, s string)
| 31 | // hashAdd adds a string to a fnv64a hash value, returning the updated hash. |
| 32 | // Note this is the same algorithm as Go stdlib `sum64a.Write()` |
| 33 | func hashAdd(h uint64, s string) uint64 { |
| 34 | for i := 0; i < len(s); i++ { |
| 35 | h ^= uint64(s[i]) |
| 36 | h *= prime64 |
| 37 | } |
| 38 | return h |
| 39 | } |
| 40 | |
| 41 | // hashAddByte adds a byte to a fnv64a hash value, returning the updated hash. |
| 42 | func hashAddByte(h uint64, b byte) uint64 { |