]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c
2 InterlockedCompareExchange16 function
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
11 Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.
15 _InterlockedCompareExchange16 (
16 __int16
volatile *Destination
,
21 #pragma intrinsic(_InterlockedCompareExchange16)
24 Performs an atomic compare exchange operation on a 16-bit unsigned integer.
26 Performs an atomic compare exchange operation on the 16-bit unsigned integer specified
27 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
28 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
29 The compare exchange operation must be performed using MP safe mechanisms.
31 @param Value A pointer to the 16-bit value for the compare exchange
33 @param CompareValue 16-bit value used in compare operation.
34 @param ExchangeValue 16-bit value used in exchange operation.
36 @return The original *Value before exchange.
41 InternalSyncCompareExchange16 (
42 IN
volatile UINT16
*Value
,
43 IN UINT16 CompareValue
,
44 IN UINT16 ExchangeValue
47 return _InterlockedCompareExchange16 (Value
, ExchangeValue
, CompareValue
);