mirror of
https://github.com/boostorg/atomic.git
synced 2026-02-01 20:12:09 +00:00
These operations are useful for two reasons. First, they are needed by atomic<> interface as the pre-increment/decrement and add/subtract operators need to perform the corresponding arithmetics and return the actual result while not exhibiting UB in case of overflow. This means that the operation must be performed on the unsigned storage type in the backend. Second, the (op)_and_test operations on ARM and PowerPC can be implemented in a more generic way on top of the operations that return the result. And since we have those operations internally, why not expose them to users. Added tests and docs for the new operations. Also, added docs for the recently added scoped names of the memory_order enum values. Also, added a specialized "emulated" backend for the extra operations. This backend makes better use of the fact that the operations are lock-protected by avoiding any CAS-based loops.