Skip to content

Commit

Permalink
Merge pull request #98 from orcaman/calc_key_length_once
Browse files Browse the repository at this point in the history
Calc key length once
  • Loading branch information
orcaman committed May 1, 2021
2 parents 16402b4 + 8c771cd commit 44dafcb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion concurrent_map.go
Expand Up @@ -312,7 +312,8 @@ func (m ConcurrentMap) MarshalJSON() ([]byte, error) {
func fnv32(key string) uint32 {
hash := uint32(2166136261)
const prime32 = uint32(16777619)
for i := 0; i < len(key); i++ {
keyLength := len(key)
for i := 0; i < keyLength; i++ {
hash *= prime32
hash ^= uint32(key[i])
}
Expand Down

0 comments on commit 44dafcb

Please sign in to comment.