doc_32.mx raw

   1  // Copyright 2023 The Go Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style
   3  // license that can be found in the LICENSE file.
   4  
   5  //go:build 386 || arm || mips || mipsle
   6  
   7  package atomic
   8  
   9  // SwapInt64 atomically stores new into *addr and returns the previous *addr value.
  10  // Consider using the more ergonomic and less error-prone [Int64.Swap] instead
  11  // (particularly if you target 32-bit platforms; see the bugs section).
  12  func SwapInt64(addr *int64, new int64) (old int64)
  13  
  14  // SwapUint64 atomically stores new into *addr and returns the previous *addr value.
  15  // Consider using the more ergonomic and less error-prone [Uint64.Swap] instead
  16  // (particularly if you target 32-bit platforms; see the bugs section).
  17  func SwapUint64(addr *uint64, new uint64) (old uint64)
  18  
  19  // CompareAndSwapInt64 executes the compare-and-swap operation for an int64 value.
  20  // Consider using the more ergonomic and less error-prone [Int64.CompareAndSwap] instead
  21  // (particularly if you target 32-bit platforms; see the bugs section).
  22  func CompareAndSwapInt64(addr *int64, old, new int64) (swapped bool)
  23  
  24  // CompareAndSwapUint64 executes the compare-and-swap operation for a uint64 value.
  25  // Consider using the more ergonomic and less error-prone [Uint64.CompareAndSwap] instead
  26  // (particularly if you target 32-bit platforms; see the bugs section).
  27  func CompareAndSwapUint64(addr *uint64, old, new uint64) (swapped bool)
  28  
  29  // AddInt64 atomically adds delta to *addr and returns the new value.
  30  // Consider using the more ergonomic and less error-prone [Int64.Add] instead
  31  // (particularly if you target 32-bit platforms; see the bugs section).
  32  func AddInt64(addr *int64, delta int64) (new int64)
  33  
  34  // AddUint64 atomically adds delta to *addr and returns the new value.
  35  // To subtract a signed positive constant value c from x, do AddUint64(&x, ^uint64(c-1)).
  36  // In particular, to decrement x, do AddUint64(&x, ^uint64(0)).
  37  // Consider using the more ergonomic and less error-prone [Uint64.Add] instead
  38  // (particularly if you target 32-bit platforms; see the bugs section).
  39  func AddUint64(addr *uint64, delta uint64) (new uint64)
  40  
  41  // AndInt64 atomically performs a bitwise AND operation on *addr using the bitmask provided as mask
  42  // and returns the old value.
  43  // Consider using the more ergonomic and less error-prone [Int64.And] instead.
  44  func AndInt64(addr *int64, mask int64) (old int64)
  45  
  46  // AndUint64 atomically performs a bitwise AND operation on *addr using the bitmask provided as mask
  47  // and returns the old.
  48  // Consider using the more ergonomic and less error-prone [Uint64.And] instead.
  49  func AndUint64(addr *uint64, mask uint64) (old uint64)
  50  
  51  // OrInt64 atomically performs a bitwise OR operation on *addr using the bitmask provided as mask
  52  // and returns the old value.
  53  // Consider using the more ergonomic and less error-prone [Int64.Or] instead.
  54  func OrInt64(addr *int64, mask int64) (old int64)
  55  
  56  // OrUint64 atomically performs a bitwise OR operation on *addr using the bitmask provided as mask
  57  // and returns the old value.
  58  // Consider using the more ergonomic and less error-prone [Uint64.Or] instead.
  59  func OrUint64(addr *uint64, mask uint64) (old uint64)
  60  
  61  // LoadInt64 atomically loads *addr.
  62  // Consider using the more ergonomic and less error-prone [Int64.Load] instead
  63  // (particularly if you target 32-bit platforms; see the bugs section).
  64  func LoadInt64(addr *int64) (val int64)
  65  
  66  // LoadUint64 atomically loads *addr.
  67  // Consider using the more ergonomic and less error-prone [Uint64.Load] instead
  68  // (particularly if you target 32-bit platforms; see the bugs section).
  69  func LoadUint64(addr *uint64) (val uint64)
  70  
  71  // StoreInt64 atomically stores val into *addr.
  72  // Consider using the more ergonomic and less error-prone [Int64.Store] instead
  73  // (particularly if you target 32-bit platforms; see the bugs section).
  74  func StoreInt64(addr *int64, val int64)
  75  
  76  // StoreUint64 atomically stores val into *addr.
  77  // Consider using the more ergonomic and less error-prone [Uint64.Store] instead
  78  // (particularly if you target 32-bit platforms; see the bugs section).
  79  func StoreUint64(addr *uint64, val uint64)
  80