@atomicRmw

@atomicRmw

@atomicRmw(comptime T: type, ptr: *T, comptime op: builtin.AtomicRmwOp, operand: T, comptime ordering: builtin.AtomicOrder) T

This builtin function atomically modifies memory and then returns the previous value.

T must be a pointer type, a bool, or an integer whose bit count meets these requirements:

  • At least 8
  • At most the same as usize
  • Power of 2

TODO right now bool is not accepted. Also I think we could make non powers of 2 work fine, maybe we can remove this restriction