Skip to content

Commit

Permalink
fix hash typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago Silva committed Dec 22, 2021
1 parent c93d96c commit 58fbe69
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hashmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ func (m *HashMap) indexElement(hashedKey uintptr) (data *hashMapData, item *List
index := hashedKey >> data.keyshifts
ptr := (*unsafe.Pointer)(unsafe.Pointer(uintptr(data.data) + index*intSizeBytes))
item = (*ListElement)(atomic.LoadPointer(ptr))

for (item == nil || hashedKey < item.keyHash) && index > 0 {
index--
ptr = (*unsafe.Pointer)(unsafe.Pointer(uintptr(data.data) + index*intSizeBytes))
item = (*ListElement)(atomic.LoadPointer(ptr))
}
return data, item
}

Expand Down

0 comments on commit 58fbe69

Please sign in to comment.