func (s *Float32MapDesc) Delete(key float32) bool {
	var (
		nodeToDelete *float32NodeDesc
		isMarked     bool  
		topLayer     = -1
		preds, succs [maxLevel]*float32NodeDesc
	)
	for {
		lFound := s.findNodeDelete(key, &preds, &succs)
		if isMarked ||  
			lFound != -1 && succs[lFound].flags.MGet(fullyLinked|marked, fullyLinked) && (int(succs[lFound].level)-1) == lFound {
			if !isMarked {  
				nodeToDelete = succs[lFound]
				topLayer = lFound
				nodeToDelete.mu.Lock()
				if nodeToDelete.flags.Get(marked) {
					nodeToDelete.mu.Unlock()
					return false
				}
				nodeToDelete.flags.SetTrue(marked)
				isMarked = true
			}
			var (
				highestLocked        = -1  
				valid                = true
				pred, succ, prevPred *float32NodeDesc
			)
			for layer := 0; valid && (layer <= topLayer); layer++ {
				pred, succ = preds[layer], succs[layer]
				if pred != prevPred {  
					pred.mu.Lock()
					highestLocked = layer
					prevPred = pred
				}
				valid = !pred.flags.Get(marked) && pred.atomicLoadNext(layer) == succ
			}
			if !valid {
				unlockFloat32Desc(preds, highestLocked)
				continue
			}
			for i := topLayer; i >= 0; i-- {
				preds[i].atomicStoreNext(i, nodeToDelete.loadNext(i))
			}
			nodeToDelete.mu.Unlock()
			unlockFloat32Desc(preds, highestLocked)
			atomic.AddInt64(&s.length, -1)
			return true
		}
		return false
	}
}
Delete deletes the value for a key.
package skipmap
import (
	"sync"
	"sync/atomic"
	"unsafe"
)
type Float32Map struct {
	header       *float32Node
	length       int64
	highestLevel int64  
}
type float32Node struct {
	key   float32
	value unsafe.Pointer  
	next  optionalArray   
	mu    sync.Mutex
	flags bitflag
	level uint32
}
func newFloat32Node(key float32, value interface{}, level int) *float32Node {
	node := &float32Node{
		key:   key,
		level: uint32(level),
	}
	node.storeVal(value)
	if level > op1 {
		node.next.extra = new([op2]unsafe.Pointer)
	}
	return node
}
func (n *float32Node) storeVal(value interface{}) {
	atomic.StorePointer(&n.value, unsafe.Pointer(&value))
}
func (n *float32Node) loadVal() interface{} {
	return *(*interface{})(atomic.LoadPointer(&n.value))
}
func (n *float32Node) loadNext(i int) *float32Node {
	return (*float32Node)(n.next.load(i))
}
func (n *float32Node) storeNext(i int, node *float32Node) {
	n.next.store(i, unsafe.Pointer(node))
}
func (n *float32Node) atomicLoadNext(i int) *float32Node {
	return (*float32Node)(n.next.atomicLoad(i))
}
func (n *float32Node) atomicStoreNext(i int, node *float32Node) {
	n.next.atomicStore(i, unsafe.Pointer(node))
}
func (n *float32Node) lessthan(key float32) bool {
	return n.key < key
}
func (n *float32Node) equal(key float32) bool {
	return n.key == key
}
func NewFloat32() *Float32Map {
	h := newFloat32Node(0, "", maxLevel)
	h.flags.SetTrue(fullyLinked)
	return &Float32Map{
		header:       h,
		highestLevel: defaultHighestLevel,
	}
}
func (s *Float32Map) findNode(key float32, preds *[maxLevel]*float32Node, succs *[maxLevel]*float32Node) *float32Node {
	x := s.header
	for i := int(atomic.LoadInt64(&s.highestLevel)) - 1; i >= 0; i-- {
		succ := x.atomicLoadNext(i)
		for succ != nil && succ.lessthan(key) {
			x = succ
			succ = x.atomicLoadNext(i)
		}
		preds[i] = x
		succs[i] = succ
		if succ != nil && succ.equal(key) {
			return succ
		}
	}
	return nil
}
func (s *Float32Map) findNodeDelete(key float32, preds *[maxLevel]*float32Node, succs *[maxLevel]*float32Node) int {
	lFound, x := -1, s.header
	for i := int(atomic.LoadInt64(&s.highestLevel)) - 1; i >= 0; i-- {
		succ := x.atomicLoadNext(i)
		for succ != nil && succ.lessthan(key) {
			x = succ
			succ = x.atomicLoadNext(i)
		}
		preds[i] = x
		succs[i] = succ
		if lFound == -1 && succ != nil && succ.equal(key) {
			lFound = i
		}
	}
	return lFound
}
func unlockFloat32(preds [maxLevel]*float32Node, highestLevel int) {
	var prevPred *float32Node
	for i := highestLevel; i >= 0; i-- {
		if preds[i] != prevPred {  
			preds[i].mu.Unlock()
			prevPred = preds[i]
		}
	}
}
func (s *Float32Map) Store(key float32, value interface{}) {
	level := s.randomlevel()
	var preds, succs [maxLevel]*float32Node
	for {
		nodeFound := s.findNode(key, &preds, &succs)
		if nodeFound != nil {  
			if !nodeFound.flags.Get(marked) {
				nodeFound.storeVal(value)
				return
			}
			continue
		}
		var (
			highestLocked        = -1  
			valid                = true
			pred, succ, prevPred *float32Node
		)
		for layer := 0; valid && layer < level; layer++ {
			pred = preds[layer]    
			succ = succs[layer]    
			if pred != prevPred {  
				pred.mu.Lock()
				highestLocked = layer
				prevPred = pred
			}
			valid = !pred.flags.Get(marked) && (succ == nil || !succ.flags.Get(marked)) && pred.loadNext(layer) == succ
		}
		if !valid {
			unlockFloat32(preds, highestLocked)
			continue
		}
		nn := newFloat32Node(key, value, level)
		for layer := 0; layer < level; layer++ {
			nn.storeNext(layer, succs[layer])
			preds[layer].atomicStoreNext(layer, nn)
		}
		nn.flags.SetTrue(fullyLinked)
		unlockFloat32(preds, highestLocked)
		atomic.AddInt64(&s.length, 1)
	}
}
func (s *Float32Map) randomlevel() int {
	level := randomLevel()
	for {
		hl := atomic.LoadInt64(&s.highestLevel)
		if int64(level) <= hl {
			break
		}
		if atomic.CompareAndSwapInt64(&s.highestLevel, hl, int64(level)) {
			break
		}
	}
	return level
}
func (s *Float32Map) Load(key float32) (value interface{}, ok bool) {
	x := s.header
	for i := int(atomic.LoadInt64(&s.highestLevel)) - 1; i >= 0; i-- {
		nex := x.atomicLoadNext(i)
		for nex != nil && nex.lessthan(key) {
			x = nex
			nex = x.atomicLoadNext(i)
		}
		if nex != nil && nex.equal(key) {
			if nex.flags.MGet(fullyLinked|marked, fullyLinked) {
				return nex.loadVal(), true
			}
			return nil, false
		}
	}
	return nil, false
}
func (s *Float32Map) LoadAndDelete(key float32) (value interface{}, loaded bool) {
	var (
		nodeToDelete *float32Node
		isMarked     bool  
		topLayer     = -1
		preds, succs [maxLevel]*float32Node
	)
	for {
		lFound := s.findNodeDelete(key, &preds, &succs)
		if isMarked ||  
			lFound != -1 && succs[lFound].flags.MGet(fullyLinked|marked, fullyLinked) && (int(succs[lFound].level)-1) == lFound {
			if !isMarked {  
				nodeToDelete = succs[lFound]
				topLayer = lFound
				nodeToDelete.mu.Lock()
				if nodeToDelete.flags.Get(marked) {
					nodeToDelete.mu.Unlock()
					return nil, false
				}
				nodeToDelete.flags.SetTrue(marked)
				isMarked = true
			}
			var (
				highestLocked        = -1  
				valid                = true
				pred, succ, prevPred *float32Node
			)
			for layer := 0; valid && (layer <= topLayer); layer++ {
				pred, succ = preds[layer], succs[layer]
				if pred != prevPred {  
					pred.mu.Lock()
					highestLocked = layer
					prevPred = pred
				}
				valid = !pred.flags.Get(marked) && pred.loadNext(layer) == succ
			}
			if !valid {
				unlockFloat32(preds, highestLocked)
				continue
			}
			for i := topLayer; i >= 0; i-- {
				preds[i].atomicStoreNext(i, nodeToDelete.loadNext(i))
			}
			nodeToDelete.mu.Unlock()
			unlockFloat32(preds, highestLocked)
			atomic.AddInt64(&s.length, -1)
			return nodeToDelete.loadVal(), true
		}
		return nil, false
	}
}
func (s *Float32Map) LoadOrStore(key float32, value interface{}) (actual interface{}, loaded bool) {
	level := s.randomlevel()
	var preds, succs [maxLevel]*float32Node
	for {
		nodeFound := s.findNode(key, &preds, &succs)
		if nodeFound != nil {  
			if !nodeFound.flags.Get(marked) {
				return nodeFound.loadVal(), true
			}
			continue
		}
		var (
			highestLocked        = -1  
			valid                = true
			pred, succ, prevPred *float32Node
		)
		for layer := 0; valid && layer < level; layer++ {
			pred = preds[layer]    
			succ = succs[layer]    
			if pred != prevPred {  
				pred.mu.Lock()
				highestLocked = layer
				prevPred = pred
			}
			valid = !pred.flags.Get(marked) && (succ == nil || !succ.flags.Get(marked)) && pred.loadNext(layer) == succ
		}
		if !valid {
			unlockFloat32(preds, highestLocked)
			continue
		}
		nn := newFloat32Node(key, value, level)
		for layer := 0; layer < level; layer++ {
			nn.storeNext(layer, succs[layer])
			preds[layer].atomicStoreNext(layer, nn)
		}
		nn.flags.SetTrue(fullyLinked)
		unlockFloat32(preds, highestLocked)
		atomic.AddInt64(&s.length, 1)
		return value, false
	}
}
func (s *Float32Map) LoadOrStoreLazy(key float32, f func() interface{}) (actual interface{}, loaded bool) {
	level := s.randomlevel()
	var preds, succs [maxLevel]*float32Node
	for {
		nodeFound := s.findNode(key, &preds, &succs)
		if nodeFound != nil {  
			if !nodeFound.flags.Get(marked) {
				return nodeFound.loadVal(), true
			}
			continue
		}
		var (
			highestLocked        = -1  
			valid                = true
			pred, succ, prevPred *float32Node
		)
		for layer := 0; valid && layer < level; layer++ {
			pred = preds[layer]    
			succ = succs[layer]    
			if pred != prevPred {  
				pred.mu.Lock()
				highestLocked = layer
				prevPred = pred
			}
			valid = !pred.flags.Get(marked) && pred.loadNext(layer) == succ && (succ == nil || !succ.flags.Get(marked))
		}
		if !valid {
			unlockFloat32(preds, highestLocked)
			continue
		}
		value := f()
		nn := newFloat32Node(key, value, level)
		for layer := 0; layer < level; layer++ {
			nn.storeNext(layer, succs[layer])
			preds[layer].atomicStoreNext(layer, nn)
		}
		nn.flags.SetTrue(fullyLinked)
		unlockFloat32(preds, highestLocked)
		atomic.AddInt64(&s.length, 1)
		return value, false
	}
}
func (s *Float32Map) Delete(key float32) bool {
	var (
		nodeToDelete *float32Node
		isMarked     bool  
		topLayer     = -1
		preds, succs [maxLevel]*float32Node
	)
	for {
		lFound := s.findNodeDelete(key, &preds, &succs)
		if isMarked ||  
			lFound != -1 && succs[lFound].flags.MGet(fullyLinked|marked, fullyLinked) && (int(succs[lFound].level)-1) == lFound {
			if !isMarked {  
				nodeToDelete = succs[lFound]
				topLayer = lFound
				nodeToDelete.mu.Lock()
				if nodeToDelete.flags.Get(marked) {
					nodeToDelete.mu.Unlock()
					return false
				}
				nodeToDelete.flags.SetTrue(marked)
				isMarked = true
			}
			var (
				highestLocked        = -1  
				valid                = true
				pred, succ, prevPred *float32Node
			)
			for layer := 0; valid && (layer <= topLayer); layer++ {
				pred, succ = preds[layer], succs[layer]
				if pred != prevPred {  
					pred.mu.Lock()
					highestLocked = layer
					prevPred = pred
				}
				valid = !pred.flags.Get(marked) && pred.atomicLoadNext(layer) == succ
			}
			if !valid {
				unlockFloat32(preds, highestLocked)
				continue
			}
			for i := topLayer; i >= 0; i-- {
				preds[i].atomicStoreNext(i, nodeToDelete.loadNext(i))
			}
			nodeToDelete.mu.Unlock()
			unlockFloat32(preds, highestLocked)
			atomic.AddInt64(&s.length, -1)
			return true
		}
		return false
	}
}
func (s *Float32Map) Range(f func(key float32, value interface{}) bool) {
	x := s.header.atomicLoadNext(0)
	for x != nil {
		if !x.flags.MGet(fullyLinked|marked, fullyLinked) {
			x = x.atomicLoadNext(0)
			continue
		}
		if !f(x.key, x.loadVal()) {
			break
		}
		x = x.atomicLoadNext(0)
	}
}
func (s *Float32Map) Len() int {
	return int(atomic.LoadInt64(&s.length))
}
type Float32MapDesc struct {
	header       *float32NodeDesc
	length       int64
	highestLevel int64  
}
type float32NodeDesc struct {
	key   float32
	value unsafe.Pointer  
	next  optionalArray   
	mu    sync.Mutex
	flags bitflag
	level uint32
}
func newFloat32NodeDesc(key float32, value interface{}, level int) *float32NodeDesc {
	node := &float32NodeDesc{
		key:   key,
		level: uint32(level),
	}
	node.storeVal(value)
	if level > op1 {
		node.next.extra = new([op2]unsafe.Pointer)
	}
	return node
}
func (n *float32NodeDesc) storeVal(value interface{}) {
	atomic.StorePointer(&n.value, unsafe.Pointer(&value))
}
func (n *float32NodeDesc) loadVal() interface{} {
	return *(*interface{})(atomic.LoadPointer(&n.value))
}
func (n *float32NodeDesc) loadNext(i int) *float32NodeDesc {
	return (*float32NodeDesc)(n.next.load(i))
}
func (n *float32NodeDesc) storeNext(i int, node *float32NodeDesc) {
	n.next.store(i, unsafe.Pointer(node))
}
func (n *float32NodeDesc) atomicLoadNext(i int) *float32NodeDesc {
	return (*float32NodeDesc)(n.next.atomicLoad(i))
}
func (n *float32NodeDesc) atomicStoreNext(i int, node *float32NodeDesc) {
	n.next.atomicStore(i, unsafe.Pointer(node))
}
func (n *float32NodeDesc) lessthan(key float32) bool {
	return n.key > key
}
func (n *float32NodeDesc) equal(key float32) bool {
	return n.key == key
}
func NewFloat32Desc() *Float32MapDesc {
	h := newFloat32NodeDesc(0, "", maxLevel)
	h.flags.SetTrue(fullyLinked)
	return &Float32MapDesc{
		header:       h,
		highestLevel: defaultHighestLevel,
	}
}
func (s *Float32MapDesc) findNode(key float32, preds *[maxLevel]*float32NodeDesc, succs *[maxLevel]*float32NodeDesc) *float32NodeDesc {
	x := s.header
	for i := int(atomic.LoadInt64(&s.highestLevel)) - 1; i >= 0; i-- {
		succ := x.atomicLoadNext(i)
		for succ != nil && succ.lessthan(key) {
			x = succ
			succ = x.atomicLoadNext(i)
		}
		preds[i] = x
		succs[i] = succ
		if succ != nil && succ.equal(key) {
			return succ
		}
	}
	return nil
}
func (s *Float32MapDesc) findNodeDelete(key float32, preds *[maxLevel]*float32NodeDesc, succs *[maxLevel]*float32NodeDesc) int {
	lFound, x := -1, s.header
	for i := int(atomic.LoadInt64(&s.highestLevel)) - 1; i >= 0; i-- {
		succ := x.atomicLoadNext(i)
		for succ != nil && succ.lessthan(key) {
			x = succ
			succ = x.atomicLoadNext(i)
		}
		preds[i] = x
		succs[i] = succ
		if lFound == -1 && succ != nil && succ.equal(key) {
			lFound = i
		}
	}
	return lFound
}
func unlockFloat32Desc(preds [maxLevel]*float32NodeDesc, highestLevel int) {
	var prevPred *float32NodeDesc
	for i := highestLevel; i >= 0; i-- {
		if preds[i] != prevPred {  
			preds[i].mu.Unlock()
			prevPred = preds[i]
		}
	}
}
func (s *Float32MapDesc) Store(key float32, value interface{}) {
	level := s.randomlevel()
	var preds, succs [maxLevel]*float32NodeDesc
	for {
		nodeFound := s.findNode(key, &preds, &succs)
		if nodeFound != nil {  
			if !nodeFound.flags.Get(marked) {
				nodeFound.storeVal(value)
				return
			}
			continue
		}
		var (
			highestLocked        = -1  
			valid                = true
			pred, succ, prevPred *float32NodeDesc
		)
		for layer := 0; valid && layer < level; layer++ {
			pred = preds[layer]    
			succ = succs[layer]    
			if pred != prevPred {  
				pred.mu.Lock()
				highestLocked = layer
				prevPred = pred
			}
			valid = !pred.flags.Get(marked) && (succ == nil || !succ.flags.Get(marked)) && pred.loadNext(layer) == succ
		}
		if !valid {
			unlockFloat32Desc(preds, highestLocked)
			continue
		}
		nn := newFloat32NodeDesc(key, value, level)
		for layer := 0; layer < level; layer++ {
			nn.storeNext(layer, succs[layer])
			preds[layer].atomicStoreNext(layer, nn)
		}
		nn.flags.SetTrue(fullyLinked)
		unlockFloat32Desc(preds, highestLocked)
		atomic.AddInt64(&s.length, 1)
	}
}
func (s *Float32MapDesc) randomlevel() int {
	level := randomLevel()
	for {
		hl := atomic.LoadInt64(&s.highestLevel)
		if int64(level) <= hl {
			break
		}
		if atomic.CompareAndSwapInt64(&s.highestLevel, hl, int64(level)) {
			break
		}
	}
	return level
}
func (s *Float32MapDesc) Load(key float32) (value interface{}, ok bool) {
	x := s.header
	for i := int(atomic.LoadInt64(&s.highestLevel)) - 1; i >= 0; i-- {
		nex := x.atomicLoadNext(i)
		for nex != nil && nex.lessthan(key) {
			x = nex
			nex = x.atomicLoadNext(i)
		}
		if nex != nil && nex.equal(key) {
			if nex.flags.MGet(fullyLinked|marked, fullyLinked) {
				return nex.loadVal(), true
			}
			return nil, false
		}
	}
	return nil, false
}
func (s *Float32MapDesc) LoadAndDelete(key float32) (value interface{}, loaded bool) {
	var (
		nodeToDelete *float32NodeDesc
		isMarked     bool  
		topLayer     = -1
		preds, succs [maxLevel]*float32NodeDesc
	)
	for {
		lFound := s.findNodeDelete(key, &preds, &succs)
		if isMarked ||  
			lFound != -1 && succs[lFound].flags.MGet(fullyLinked|marked, fullyLinked) && (int(succs[lFound].level)-1) == lFound {
			if !isMarked {  
				nodeToDelete = succs[lFound]
				topLayer = lFound
				nodeToDelete.mu.Lock()
				if nodeToDelete.flags.Get(marked) {
					nodeToDelete.mu.Unlock()
					return nil, false
				}
				nodeToDelete.flags.SetTrue(marked)
				isMarked = true
			}
			var (
				highestLocked        = -1  
				valid                = true
				pred, succ, prevPred *float32NodeDesc
			)
			for layer := 0; valid && (layer <= topLayer); layer++ {
				pred, succ = preds[layer], succs[layer]
				if pred != prevPred {  
					pred.mu.Lock()
					highestLocked = layer
					prevPred = pred
				}
				valid = !pred.flags.Get(marked) && pred.loadNext(layer) == succ
			}
			if !valid {
				unlockFloat32Desc(preds, highestLocked)
				continue
			}
			for i := topLayer; i >= 0; i-- {
				preds[i].atomicStoreNext(i, nodeToDelete.loadNext(i))
			}
			nodeToDelete.mu.Unlock()
			unlockFloat32Desc(preds, highestLocked)
			atomic.AddInt64(&s.length, -1)
			return nodeToDelete.loadVal(), true
		}
		return nil, false
	}
}
func (s *Float32MapDesc) LoadOrStore(key float32, value interface{}) (actual interface{}, loaded bool) {
	level := s.randomlevel()
	var preds, succs [maxLevel]*float32NodeDesc
	for {
		nodeFound := s.findNode(key, &preds, &succs)
		if nodeFound != nil {  
			if !nodeFound.flags.Get(marked) {
				return nodeFound.loadVal(), true
			}
			continue
		}
		var (
			highestLocked        = -1  
			valid                = true
			pred, succ, prevPred *float32NodeDesc
		)
		for layer := 0; valid && layer < level; layer++ {
			pred = preds[layer]    
			succ = succs[layer]    
			if pred != prevPred {  
				pred.mu.Lock()
				highestLocked = layer
				prevPred = pred
			}
			valid = !pred.flags.Get(marked) && (succ == nil || !succ.flags.Get(marked)) && pred.loadNext(layer) == succ
		}
		if !valid {
			unlockFloat32Desc(preds, highestLocked)
			continue
		}
		nn := newFloat32NodeDesc(key, value, level)
		for layer := 0; layer < level; layer++ {
			nn.storeNext(layer, succs[layer])
			preds[layer].atomicStoreNext(layer, nn)
		}
		nn.flags.SetTrue(fullyLinked)
		unlockFloat32Desc(preds, highestLocked)
		atomic.AddInt64(&s.length, 1)
		return value, false
	}
}
func (s *Float32MapDesc) LoadOrStoreLazy(key float32, f func() interface{}) (actual interface{}, loaded bool) {
	level := s.randomlevel()
	var preds, succs [maxLevel]*float32NodeDesc
	for {
		nodeFound := s.findNode(key, &preds, &succs)
		if nodeFound != nil {  
			if !nodeFound.flags.Get(marked) {
				return nodeFound.loadVal(), true
			}
			continue
		}
		var (
			highestLocked        = -1  
			valid                = true
			pred, succ, prevPred *float32NodeDesc
		)
		for layer := 0; valid && layer < level; layer++ {
			pred = preds[layer]    
			succ = succs[layer]    
			if pred != prevPred {  
				pred.mu.Lock()
				highestLocked = layer
				prevPred = pred
			}
			valid = !pred.flags.Get(marked) && pred.loadNext(layer) == succ && (succ == nil || !succ.flags.Get(marked))
		}
		if !valid {
			unlockFloat32Desc(preds, highestLocked)
			continue
		}
		value := f()
		nn := newFloat32NodeDesc(key, value, level)
		for layer := 0; layer < level; layer++ {
			nn.storeNext(layer, succs[layer])
			preds[layer].atomicStoreNext(layer, nn)
		}
		nn.flags.SetTrue(fullyLinked)
		unlockFloat32Desc(preds, highestLocked)
		atomic.AddInt64(&s.length, 1)
		return value, false
	}
}