func (m *Map) LoadOrStore(key string, value interface{}) (actual interface{}, loaded bool) {
	return m.doStore(key, value, true)
}
LoadOrStore returns the existing value for the key if present.
Otherwise, it stores and returns the given value.
The loaded result is true if the value was loaded, false if stored.
package xsync
import (
	"fmt"
	"math"
	"sync"
	"sync/atomic"
	"unsafe"
)
type mapResizeHint int
const (
	mapGrowHint   mapResizeHint = 0
	mapShrinkHint mapResizeHint = 1
)
const (
	entriesPerMapBucket = 7
	mapShrinkFraction = 128
	minMapTableLen = 32
	maxMapCounterLen = 128
)
type Map struct {
	table        unsafe.Pointer  
	resizing     int64           
	resizeMu     sync.Mutex      
	resizeCond   sync.Cond       
	totalGrowths int64
	totalShrinks int64
}
type mapTable struct {
	buckets []bucket
	size []counterStripe
}
type counterStripe struct {
	c   int64
	pad [cacheLineSize - 8]byte
}
type bucket struct {
	mu     sync.Mutex
	keys   [entriesPerMapBucket]unsafe.Pointer
	values [entriesPerMapBucket]unsafe.Pointer
	topHashes uint64
}
type rangeEntry struct {
	key   unsafe.Pointer
	value unsafe.Pointer
}
type nilValue struct{}
var nilVal = new(nilValue)
func NewMap() *Map {
	m := &Map{}
	m.resizeCond = *sync.NewCond(&m.resizeMu)
	table := newMapTable(minMapTableLen)
	atomic.StorePointer(&m.table, unsafe.Pointer(table))
	return m
}
func newMapTable(size int) *mapTable {
	buckets := make([]bucket, size)
	counterLen := size >> 10
	if counterLen < minMapTableLen {
		counterLen = minMapTableLen
	} else if counterLen > maxMapCounterLen {
		counterLen = maxMapCounterLen
	}
	counter := make([]counterStripe, counterLen)
	t := &mapTable{
		buckets: buckets,
		size:    counter,
	}
	return t
}
func (m *Map) Load(key string) (value interface{}, ok bool) {
	hash := maphash64(key)
	table := (*mapTable)(atomic.LoadPointer(&m.table))
	bidx := bucketIdx(table, hash)
	b := &table.buckets[bidx]
	topHashes := atomic.LoadUint64(&b.topHashes)
	for i := 0; i < entriesPerMapBucket; i++ {
		if !topHashMatch(hash, topHashes, i) {
			continue
		}
	atomic_snapshot:
		vp := atomic.LoadPointer(&b.values[i])
		kp := atomic.LoadPointer(&b.keys[i])
		if kp != nil && vp != nil {
			if key == derefKey(kp) {
				if uintptr(vp) == uintptr(atomic.LoadPointer(&b.values[i])) {
					return derefValue(vp), true
				}
				goto atomic_snapshot
			}
		}
	}
	return nil, false
}
func (m *Map) Store(key string, value interface{}) {
	m.doStore(key, value, false)
}