Skip to content

Commit

Permalink
doc: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyunhao116 committed Dec 11, 2022
1 parent 03e1550 commit cb7705f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions bithack.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ func makeUint64BucketArray(size int) unsafe.Pointer {
}

func matchTopHash(tophash [bucketCnt]uint8, top uint8) bitmask64 {
// For the technique, see:
// http://graphics.stanford.edu/~seander/bithacks.html##ValueInWord
// (Determine if a word has a byte equal to n).
//
// The idea comes from SwissTable C++ version:
// https://github.com/abseil/abseil-cpp/blob/master/absl/container/internal/raw_hash_set.h#L661
ctrl := littleEndianBytesToUint64(tophash)
cmp := ctrl ^ (lsbs * uint64(top))
return bitmask64((cmp - lsbs) & ^cmp & msbs)
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

umap is a fast, reliable, simple hashmap that only supports the uint64 key/value pair. It is faster than the runtime hashmap in most cases.

The umap is mainly based on the SwissTable(https://github.com/abseil/abseil-cpp/blob/master/absl/container/internal/raw_hash_set.h).
The umap is mainly based on the SwissTable(https://github.com/abseil/abseil-cpp/blob/master/absl/container/internal/raw_hash_set.h), it is portable for all platforms and doesn't require SSE or AVX.

## QuickStart

Expand Down

0 comments on commit cb7705f

Please sign in to comment.