// Generated by Lisette bindgen
// Source: sync/atomic (Go stdlib)
// Go: 1.25.5
// Lisette: 0.1.11

/// AddInt32 atomically adds delta to *addr and returns the new value.
/// Consider using the more ergonomic and less error-prone [Int32.Add] instead.
pub fn AddInt32(addr: Ref<int32>, delta: int32) -> int32

/// AddInt64 atomically adds delta to *addr and returns the new value.
/// Consider using the more ergonomic and less error-prone [Int64.Add] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn AddInt64(addr: Ref<int64>, delta: int64) -> int64

/// AddUint32 atomically adds delta to *addr and returns the new value.
/// To subtract a signed positive constant value c from x, do AddUint32(&x, ^uint32(c-1)).
/// In particular, to decrement x, do AddUint32(&x, ^uint32(0)).
/// Consider using the more ergonomic and less error-prone [Uint32.Add] instead.
pub fn AddUint32(addr: Ref<uint32>, delta: uint32) -> uint32

/// AddUint64 atomically adds delta to *addr and returns the new value.
/// To subtract a signed positive constant value c from x, do AddUint64(&x, ^uint64(c-1)).
/// In particular, to decrement x, do AddUint64(&x, ^uint64(0)).
/// Consider using the more ergonomic and less error-prone [Uint64.Add] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn AddUint64(addr: Ref<uint64>, delta: uint64) -> uint64

/// AddUintptr atomically adds delta to *addr and returns the new value.
/// Consider using the more ergonomic and less error-prone [Uintptr.Add] instead.
pub fn AddUintptr(addr: Ref<uint>, delta: uint) -> uint

/// AndInt32 atomically performs a bitwise AND operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Int32.And] instead.
pub fn AndInt32(addr: Ref<int32>, mask: int32) -> int32

/// AndInt64 atomically performs a bitwise AND operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Int64.And] instead.
pub fn AndInt64(addr: Ref<int64>, mask: int64) -> int64

/// AndUint32 atomically performs a bitwise AND operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Uint32.And] instead.
pub fn AndUint32(addr: Ref<uint32>, mask: uint32) -> uint32

/// AndUint64 atomically performs a bitwise AND operation on *addr using the bitmask provided as mask
/// and returns the old.
/// Consider using the more ergonomic and less error-prone [Uint64.And] instead.
pub fn AndUint64(addr: Ref<uint64>, mask: uint64) -> uint64

/// AndUintptr atomically performs a bitwise AND operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Uintptr.And] instead.
pub fn AndUintptr(addr: Ref<uint>, mask: uint) -> uint

/// CompareAndSwapInt32 executes the compare-and-swap operation for an int32 value.
/// Consider using the more ergonomic and less error-prone [Int32.CompareAndSwap] instead.
pub fn CompareAndSwapInt32(addr: Ref<int32>, old: int32, new: int32) -> bool

/// CompareAndSwapInt64 executes the compare-and-swap operation for an int64 value.
/// Consider using the more ergonomic and less error-prone [Int64.CompareAndSwap] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn CompareAndSwapInt64(addr: Ref<int64>, old: int64, new: int64) -> bool

/// CompareAndSwapPointer executes the compare-and-swap operation for a unsafe.Pointer value.
/// Consider using the more ergonomic and less error-prone [Pointer.CompareAndSwap] instead.
pub fn CompareAndSwapPointer(addr: Ref<Unknown>, old: Unknown, new: Unknown) -> bool

/// CompareAndSwapUint32 executes the compare-and-swap operation for a uint32 value.
/// Consider using the more ergonomic and less error-prone [Uint32.CompareAndSwap] instead.
pub fn CompareAndSwapUint32(addr: Ref<uint32>, old: uint32, new: uint32) -> bool

/// CompareAndSwapUint64 executes the compare-and-swap operation for a uint64 value.
/// Consider using the more ergonomic and less error-prone [Uint64.CompareAndSwap] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn CompareAndSwapUint64(addr: Ref<uint64>, old: uint64, new: uint64) -> bool

/// CompareAndSwapUintptr executes the compare-and-swap operation for a uintptr value.
/// Consider using the more ergonomic and less error-prone [Uintptr.CompareAndSwap] instead.
pub fn CompareAndSwapUintptr(addr: Ref<uint>, old: uint, new: uint) -> bool

/// LoadInt32 atomically loads *addr.
/// Consider using the more ergonomic and less error-prone [Int32.Load] instead.
pub fn LoadInt32(addr: Ref<int32>) -> int32

/// LoadInt64 atomically loads *addr.
/// Consider using the more ergonomic and less error-prone [Int64.Load] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn LoadInt64(addr: Ref<int64>) -> int64

/// LoadPointer atomically loads *addr.
/// Consider using the more ergonomic and less error-prone [Pointer.Load] instead.
pub fn LoadPointer(addr: Ref<Unknown>) -> Unknown

/// LoadUint32 atomically loads *addr.
/// Consider using the more ergonomic and less error-prone [Uint32.Load] instead.
pub fn LoadUint32(addr: Ref<uint32>) -> uint32

/// LoadUint64 atomically loads *addr.
/// Consider using the more ergonomic and less error-prone [Uint64.Load] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn LoadUint64(addr: Ref<uint64>) -> uint64

/// LoadUintptr atomically loads *addr.
/// Consider using the more ergonomic and less error-prone [Uintptr.Load] instead.
pub fn LoadUintptr(addr: Ref<uint>) -> uint

/// OrInt32 atomically performs a bitwise OR operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Int32.Or] instead.
pub fn OrInt32(addr: Ref<int32>, mask: int32) -> int32

/// OrInt64 atomically performs a bitwise OR operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Int64.Or] instead.
pub fn OrInt64(addr: Ref<int64>, mask: int64) -> int64

/// OrUint32 atomically performs a bitwise OR operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Uint32.Or] instead.
pub fn OrUint32(addr: Ref<uint32>, mask: uint32) -> uint32

/// OrUint64 atomically performs a bitwise OR operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Uint64.Or] instead.
pub fn OrUint64(addr: Ref<uint64>, mask: uint64) -> uint64

/// OrUintptr atomically performs a bitwise OR operation on *addr using the bitmask provided as mask
/// and returns the old value.
/// Consider using the more ergonomic and less error-prone [Uintptr.Or] instead.
pub fn OrUintptr(addr: Ref<uint>, mask: uint) -> uint

/// StoreInt32 atomically stores val into *addr.
/// Consider using the more ergonomic and less error-prone [Int32.Store] instead.
pub fn StoreInt32(addr: Ref<int32>, val: int32)

/// StoreInt64 atomically stores val into *addr.
/// Consider using the more ergonomic and less error-prone [Int64.Store] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn StoreInt64(addr: Ref<int64>, val: int64)

/// StorePointer atomically stores val into *addr.
/// Consider using the more ergonomic and less error-prone [Pointer.Store] instead.
pub fn StorePointer(addr: Ref<Unknown>, val: Unknown)

/// StoreUint32 atomically stores val into *addr.
/// Consider using the more ergonomic and less error-prone [Uint32.Store] instead.
pub fn StoreUint32(addr: Ref<uint32>, val: uint32)

/// StoreUint64 atomically stores val into *addr.
/// Consider using the more ergonomic and less error-prone [Uint64.Store] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn StoreUint64(addr: Ref<uint64>, val: uint64)

/// StoreUintptr atomically stores val into *addr.
/// Consider using the more ergonomic and less error-prone [Uintptr.Store] instead.
pub fn StoreUintptr(addr: Ref<uint>, val: uint)

/// SwapInt32 atomically stores new into *addr and returns the previous *addr value.
/// Consider using the more ergonomic and less error-prone [Int32.Swap] instead.
pub fn SwapInt32(addr: Ref<int32>, new: int32) -> int32

/// SwapInt64 atomically stores new into *addr and returns the previous *addr value.
/// Consider using the more ergonomic and less error-prone [Int64.Swap] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn SwapInt64(addr: Ref<int64>, new: int64) -> int64

/// SwapPointer atomically stores new into *addr and returns the previous *addr value.
/// Consider using the more ergonomic and less error-prone [Pointer.Swap] instead.
pub fn SwapPointer(addr: Ref<Unknown>, new: Unknown) -> Unknown

/// SwapUint32 atomically stores new into *addr and returns the previous *addr value.
/// Consider using the more ergonomic and less error-prone [Uint32.Swap] instead.
pub fn SwapUint32(addr: Ref<uint32>, new: uint32) -> uint32

/// SwapUint64 atomically stores new into *addr and returns the previous *addr value.
/// Consider using the more ergonomic and less error-prone [Uint64.Swap] instead
/// (particularly if you target 32-bit platforms; see the bugs section).
pub fn SwapUint64(addr: Ref<uint64>, new: uint64) -> uint64

/// SwapUintptr atomically stores new into *addr and returns the previous *addr value.
/// Consider using the more ergonomic and less error-prone [Uintptr.Swap] instead.
pub fn SwapUintptr(addr: Ref<uint>, new: uint) -> uint

/// A Bool is an atomic boolean value.
/// The zero value is false.
/// 
/// Bool must not be copied after first use.
pub type Bool

/// An Int32 is an atomic int32. The zero value is zero.
/// 
/// Int32 must not be copied after first use.
pub type Int32

/// An Int64 is an atomic int64. The zero value is zero.
/// 
/// Int64 must not be copied after first use.
pub type Int64

/// A Pointer is an atomic pointer of type *T. The zero value is a nil *T.
/// 
/// Pointer must not be copied after first use.
pub type Pointer<T>

/// A Uint32 is an atomic uint32. The zero value is zero.
/// 
/// Uint32 must not be copied after first use.
pub type Uint32

/// A Uint64 is an atomic uint64. The zero value is zero.
/// 
/// Uint64 must not be copied after first use.
pub type Uint64

/// A Uintptr is an atomic uintptr. The zero value is zero.
/// 
/// Uintptr must not be copied after first use.
pub type Uintptr

/// A Value provides an atomic load and store of a consistently typed value.
/// The zero value for a Value returns nil from [Value.Load].
/// Once [Value.Store] has been called, a Value must not be copied.
/// 
/// A Value must not be copied after first use.
pub type Value

impl Bool {
  /// CompareAndSwap executes the compare-and-swap operation for the boolean value x.
  fn CompareAndSwap(self: Ref<Bool>, old: bool, new: bool) -> bool

  /// Load atomically loads and returns the value stored in x.
  fn Load(self: Ref<Bool>) -> bool

  /// Store atomically stores val into x.
  fn Store(self: Ref<Bool>, val: bool)

  /// Swap atomically stores new into x and returns the previous value.
  fn Swap(self: Ref<Bool>, new: bool) -> bool
}

impl Int32 {
  /// Add atomically adds delta to x and returns the new value.
  fn Add(self: Ref<Int32>, delta: int32) -> int32

  /// And atomically performs a bitwise AND operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn And(self: Ref<Int32>, mask: int32) -> int32

  /// CompareAndSwap executes the compare-and-swap operation for x.
  fn CompareAndSwap(self: Ref<Int32>, old: int32, new: int32) -> bool

  /// Load atomically loads and returns the value stored in x.
  fn Load(self: Ref<Int32>) -> int32

  /// Or atomically performs a bitwise OR operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn Or(self: Ref<Int32>, mask: int32) -> int32

  /// Store atomically stores val into x.
  fn Store(self: Ref<Int32>, val: int32)

  /// Swap atomically stores new into x and returns the previous value.
  fn Swap(self: Ref<Int32>, new: int32) -> int32
}

impl Int64 {
  /// Add atomically adds delta to x and returns the new value.
  fn Add(self: Ref<Int64>, delta: int64) -> int64

  /// And atomically performs a bitwise AND operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn And(self: Ref<Int64>, mask: int64) -> int64

  /// CompareAndSwap executes the compare-and-swap operation for x.
  fn CompareAndSwap(self: Ref<Int64>, old: int64, new: int64) -> bool

  /// Load atomically loads and returns the value stored in x.
  fn Load(self: Ref<Int64>) -> int64

  /// Or atomically performs a bitwise OR operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn Or(self: Ref<Int64>, mask: int64) -> int64

  /// Store atomically stores val into x.
  fn Store(self: Ref<Int64>, val: int64)

  /// Swap atomically stores new into x and returns the previous value.
  fn Swap(self: Ref<Int64>, new: int64) -> int64
}

impl<T> Pointer<T> {
  /// CompareAndSwap executes the compare-and-swap operation for x.
  fn CompareAndSwap(self: Ref<Pointer<T>>, old: Ref<T>, new: Ref<T>) -> bool

  /// Load atomically loads and returns the value stored in x.
  fn Load(self: Ref<Pointer<T>>) -> Option<Ref<T>>

  /// Store atomically stores val into x.
  fn Store(self: Ref<Pointer<T>>, val: Ref<T>)

  /// Swap atomically stores new into x and returns the previous value.
  fn Swap(self: Ref<Pointer<T>>, new: Ref<T>) -> Option<Ref<T>>
}

impl Uint32 {
  /// Add atomically adds delta to x and returns the new value.
  fn Add(self: Ref<Uint32>, delta: uint32) -> uint32

  /// And atomically performs a bitwise AND operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn And(self: Ref<Uint32>, mask: uint32) -> uint32

  /// CompareAndSwap executes the compare-and-swap operation for x.
  fn CompareAndSwap(self: Ref<Uint32>, old: uint32, new: uint32) -> bool

  /// Load atomically loads and returns the value stored in x.
  fn Load(self: Ref<Uint32>) -> uint32

  /// Or atomically performs a bitwise OR operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn Or(self: Ref<Uint32>, mask: uint32) -> uint32

  /// Store atomically stores val into x.
  fn Store(self: Ref<Uint32>, val: uint32)

  /// Swap atomically stores new into x and returns the previous value.
  fn Swap(self: Ref<Uint32>, new: uint32) -> uint32
}

impl Uint64 {
  /// Add atomically adds delta to x and returns the new value.
  fn Add(self: Ref<Uint64>, delta: uint64) -> uint64

  /// And atomically performs a bitwise AND operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn And(self: Ref<Uint64>, mask: uint64) -> uint64

  /// CompareAndSwap executes the compare-and-swap operation for x.
  fn CompareAndSwap(self: Ref<Uint64>, old: uint64, new: uint64) -> bool

  /// Load atomically loads and returns the value stored in x.
  fn Load(self: Ref<Uint64>) -> uint64

  /// Or atomically performs a bitwise OR operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn Or(self: Ref<Uint64>, mask: uint64) -> uint64

  /// Store atomically stores val into x.
  fn Store(self: Ref<Uint64>, val: uint64)

  /// Swap atomically stores new into x and returns the previous value.
  fn Swap(self: Ref<Uint64>, new: uint64) -> uint64
}

impl Uintptr {
  /// Add atomically adds delta to x and returns the new value.
  fn Add(self: Ref<Uintptr>, delta: uint) -> uint

  /// And atomically performs a bitwise AND operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn And(self: Ref<Uintptr>, mask: uint) -> uint

  /// CompareAndSwap executes the compare-and-swap operation for x.
  fn CompareAndSwap(self: Ref<Uintptr>, old: uint, new: uint) -> bool

  /// Load atomically loads and returns the value stored in x.
  fn Load(self: Ref<Uintptr>) -> uint

  /// Or atomically performs a bitwise OR operation on x using the bitmask
  /// provided as mask and returns the old value.
  fn Or(self: Ref<Uintptr>, mask: uint) -> uint

  /// Store atomically stores val into x.
  fn Store(self: Ref<Uintptr>, val: uint)

  /// Swap atomically stores new into x and returns the previous value.
  fn Swap(self: Ref<Uintptr>, new: uint) -> uint
}

impl Value {
  /// CompareAndSwap executes the compare-and-swap operation for the [Value].
  /// 
  /// All calls to CompareAndSwap for a given Value must use values of the same
  /// concrete type. CompareAndSwap of an inconsistent type panics, as does
  /// CompareAndSwap(old, nil).
  fn CompareAndSwap(self: Ref<Value>, old: Unknown, new: Unknown) -> bool

  /// Load returns the value set by the most recent Store.
  /// It returns nil if there has been no call to Store for this Value.
  fn Load(self: Ref<Value>) -> Unknown

  /// Store sets the value of the [Value] v to val.
  /// All calls to Store for a given Value must use values of the same concrete type.
  /// Store of an inconsistent type panics, as does Store(nil).
  fn Store(self: Ref<Value>, val: Unknown)

  /// Swap stores new into Value and returns the previous value. It returns nil if
  /// the Value is empty.
  /// 
  /// All calls to Swap for a given Value must use values of the same concrete
  /// type. Swap of an inconsistent type panics, as does Swap(nil).
  fn Swap(self: Ref<Value>, new: Unknown) -> Unknown
}
