[#BloombergLP-bsls-AtomicUint64-testAndSwap] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::xref:BloombergLP/bsls/AtomicUint64.adoc[AtomicUint64]::testAndSwap :relfileprefix: ../../../ :mrdocs: Conditionally swap this value if it equals `compareValue`. == Synopsis Declared in `<bsls_atomic.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:BloombergLP/bsls/Types/Uint64.adoc[Types::Uint64] testAndSwap( xref:BloombergLP/bsls/Types/Uint64.adoc[Types::Uint64] compareValue, xref:BloombergLP/bsls/Types/Uint64.adoc[Types::Uint64] swapValue); ---- == Description Compare the value of this object to the specified `compareValue`. If they are equal, set the value of this atomic 64‐bit unsigned integer to the specified `swapValue`, otherwise leave this value unchanged. Return the previous value of this atomic unsigned integer, whether or not the swap occurred. Note that the entire test‐and‐swap operation is performed atomically. == Return Value previous value of this object == Parameters [cols="1,4"] |=== | Name| Description | *compareValue* | expected current value of this object | *swapValue* | value to store if the comparison succeeds |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#