}
// Load accesses and returns the value atomically.
+//
+//go:nosplit
func (i *Int32) Load() int32 {
return Loadint32(&i.value)
}
// Store updates the value atomically.
+//
+//go:nosplit
func (i *Int32) Store(value int32) {
Storeint32(&i.value, value)
}
// and if they're equal, swaps i's value with new.
//
// Returns true if the operation succeeded.
+//
+//go:nosplit
func (i *Int32) CompareAndSwap(old, new int32) bool {
return Casint32(&i.value, old, new)
}
// Swap replaces i's value with new, returning
// i's value before the replacement.
+//
+//go:nosplit
func (i *Int32) Swap(new int32) int32 {
return Xchgint32(&i.value, new)
}
//
// This operation wraps around in the usual
// two's-complement way.
+//
+//go:nosplit
func (i *Int32) Add(delta int32) int32 {
return Xaddint32(&i.value, delta)
}
}
// Load accesses and returns the value atomically.
+//
+//go:nosplit
func (i *Int64) Load() int64 {
return Loadint64(&i.value)
}
// Store updates the value atomically.
+//
+//go:nosplit
func (i *Int64) Store(value int64) {
Storeint64(&i.value, value)
}
// and if they're equal, swaps i's value with new.
//
// Returns true if the operation succeeded.
+//
+//go:nosplit
func (i *Int64) CompareAndSwap(old, new int64) bool {
return Casint64(&i.value, old, new)
}
// Swap replaces i's value with new, returning
// i's value before the replacement.
+//
+//go:nosplit
func (i *Int64) Swap(new int64) int64 {
return Xchgint64(&i.value, new)
}
//
// This operation wraps around in the usual
// two's-complement way.
+//
+//go:nosplit
func (i *Int64) Add(delta int64) int64 {
return Xaddint64(&i.value, delta)
}
}
// Store updates the value atomically.
+//
+//go:nosplit
func (u *Uint8) Store(value uint8) {
Store8(&u.value, value)
}
// the result into u.
//
// The full process is performed atomically.
+//
+//go:nosplit
func (u *Uint8) And(value uint8) {
And8(&u.value, value)
}
// the result into u.
//
// The full process is performed atomically.
+//
+//go:nosplit
func (u *Uint8) Or(value uint8) {
Or8(&u.value, value)
}
}
// Store updates the value atomically.
+//
+//go:nosplit
func (b *Bool) Store(value bool) {
s := uint8(0)
if value {
}
// Store updates the value atomically.
+//
+//go:nosplit
func (u *Uint32) Store(value uint32) {
Store(&u.value, value)
}
// on this thread can be observed to occur after it.
//
// WARNING: Use sparingly and with great care.
+//
+//go:nosplit
func (u *Uint32) StoreRelease(value uint32) {
StoreRel(&u.value, value)
}
// and if they're equal, swaps u's value with new.
//
// Returns true if the operation succeeded.
+//
+//go:nosplit
func (u *Uint32) CompareAndSwap(old, new uint32) bool {
return Cas(&u.value, old, new)
}
// Returns true if the operation succeeded.
//
// WARNING: Use sparingly and with great care.
+//
+//go:nosplit
func (u *Uint32) CompareAndSwapRelease(old, new uint32) bool {
return CasRel(&u.value, old, new)
}
// Swap replaces u's value with new, returning
// u's value before the replacement.
+//
+//go:nosplit
func (u *Uint32) Swap(value uint32) uint32 {
return Xchg(&u.value, value)
}
// the result into u.
//
// The full process is performed atomically.
+//
+//go:nosplit
func (u *Uint32) And(value uint32) {
And(&u.value, value)
}
// the result into u.
//
// The full process is performed atomically.
+//
+//go:nosplit
func (u *Uint32) Or(value uint32) {
Or(&u.value, value)
}
//
// This operation wraps around in the usual
// two's-complement way.
+//
+//go:nosplit
func (u *Uint32) Add(delta int32) uint32 {
return Xadd(&u.value, delta)
}
}
// Store updates the value atomically.
+//
+//go:nosplit
func (u *Uint64) Store(value uint64) {
Store64(&u.value, value)
}
// and if they're equal, swaps u's value with new.
//
// Returns true if the operation succeeded.
+//
+//go:nosplit
func (u *Uint64) CompareAndSwap(old, new uint64) bool {
return Cas64(&u.value, old, new)
}
// Swap replaces u's value with new, returning
// u's value before the replacement.
+//
+//go:nosplit
func (u *Uint64) Swap(value uint64) uint64 {
return Xchg64(&u.value, value)
}
}
// Load accesses and returns the value atomically.
+//
+//go:nosplit
func (u *Uintptr) Load() uintptr {
return Loaduintptr(&u.value)
}
}
// Store updates the value atomically.
+//
+//go:nosplit
func (u *Uintptr) Store(value uintptr) {
Storeuintptr(&u.value, value)
}
// on this thread can be observed to occur after it.
//
// WARNING: Use sparingly and with great care.
+//
+//go:nosplit
func (u *Uintptr) StoreRelease(value uintptr) {
StoreReluintptr(&u.value, value)
}
// and if they're equal, swaps u's value with new.
//
// Returns true if the operation succeeded.
+//
+//go:nosplit
func (u *Uintptr) CompareAndSwap(old, new uintptr) bool {
return Casuintptr(&u.value, old, new)
}
// Swap replaces u's value with new, returning
// u's value before the replacement.
+//
+//go:nosplit
func (u *Uintptr) Swap(value uintptr) uintptr {
return Xchguintptr(&u.value, value)
}
//
// This operation wraps around in the usual
// two's-complement way.
+//
+//go:nosplit
func (u *Uintptr) Add(delta uintptr) uintptr {
return Xadduintptr(&u.value, delta)
}
}
// Store updates the value atomically.
+//
+//go:nosplit
func (f *Float64) Store(value float64) {
f.u.Store(*(*uint64)(unsafe.Pointer(&value)))
}
// perform a write barrier on value, and so this operation may
// hide pointers from the GC. Use with care and sparingly.
// It is safe to use with values not found in the Go heap.
+//
+//go:nosplit
func (u *UnsafePointer) StoreNoWB(value unsafe.Pointer) {
StorepNoWB(unsafe.Pointer(&u.value), value)
}
// perform a write barrier on value, and so this operation may
// hide pointers from the GC. Use with care and sparingly.
// It is safe to use with values not found in the Go heap.
+//
+//go:nosplit
func (u *UnsafePointer) CompareAndSwapNoWB(old, new unsafe.Pointer) bool {
return Casp1(&u.value, old, new)
}
// perform a write barrier on value, and so this operation may
// hide pointers from the GC. Use with care and sparingly.
// It is safe to use with values not found in the Go heap.
+//
+//go:nosplit
func (p *Pointer[T]) StoreNoWB(value *T) {
p.u.StoreNoWB(unsafe.Pointer(value))
}
// perform a write barrier on value, and so this operation may
// hide pointers from the GC. Use with care and sparingly.
// It is safe to use with values not found in the Go heap.
+//
+//go:nosplit
func (p *Pointer[T]) CompareAndSwapNoWB(old, new *T) bool {
return p.u.CompareAndSwapNoWB(unsafe.Pointer(old), unsafe.Pointer(new))
}