github.com/fufuok/utils@v1.0.10/xsync/export_test.go (about)

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