github.com/puzpuzpuz/xsync/v2@v2.5.2-0.20231021165734-92b8269e19a9/export_test.go (about) 1 package xsync 2 3 import "hash/maphash" 4 5 const ( 6 EntriesPerMapBucket = entriesPerMapBucket 7 MapLoadFactor = mapLoadFactor 8 MinMapTableLen = minMapTableLen 9 MinMapTableCap = minMapTableCap 10 MaxMapCounterLen = maxMapCounterLen 11 ) 12 13 type ( 14 BucketPadded = bucketPadded 15 ) 16 17 type MapStats struct { 18 mapStats 19 } 20 21 func CollectMapStats(m *Map) MapStats { 22 return MapStats{m.stats()} 23 } 24 25 func LockBucket(mu *uint64) { 26 lockBucket(mu) 27 } 28 29 func UnlockBucket(mu *uint64) { 30 unlockBucket(mu) 31 } 32 33 func TopHashMatch(hash, topHashes uint64, idx int) bool { 34 return topHashMatch(hash, topHashes, idx) 35 } 36 37 func StoreTopHash(hash, topHashes uint64, idx int) uint64 { 38 return storeTopHash(hash, topHashes, idx) 39 } 40 41 func EraseTopHash(topHashes uint64, idx int) uint64 { 42 return eraseTopHash(topHashes, idx) 43 } 44 45 func EnableAssertions() { 46 assertionsEnabled = true 47 } 48 49 func DisableAssertions() { 50 assertionsEnabled = false 51 } 52 53 func HashString(seed maphash.Seed, s string) uint64 { 54 return hashString(seed, s) 55 } 56 57 func Fastrand() uint32 { 58 return fastrand() 59 } 60 61 func NextPowOf2(v uint32) uint32 { 62 return nextPowOf2(v) 63 }