--- layout: stdlib-reference --- # RWByteAddressBuffer\.InterlockedCompareExchange ## Description Perform a 32-bit integer atomic compare-and-exchange operation at the specified byte address within the RWByteAddressBuffer. ## Signature
void RWByteAddressBuffer.InterlockedCompareExchange( uint dest, uint compare_value, uint value, out uint original_value);## Parameters #### dest : uint The address at which to perform the atomic compare-and-exchange operation. #### compare\_value : uint The value to perform bitwise comparison to the value at byteAddress. #### value : uint The value to store at byteAddress if the comparison is successful. #### original\_value : uint The original value at byteAddress before the compare-and-exchange operation. ## Remarks For SPIR-V, this function maps to OpAtomicCompareExchange. For HLSL, this function translates to InterlockedCompareExchange. For CUDA, this function maps to atomicCAS. ## Availability and Requirements Defined for the following targets: #### hlsl Available in all stages. #### glsl Available in all stages. #### cuda Available in all stages. #### metal Available in all stages. #### spirv Available in all stages.