]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/XenBusDxe/InterlockedCompareExchange16.c
OvmfPkg/XenBusDxe: fix VS2010 build failures
[mirror_edk2.git] / OvmfPkg / XenBusDxe / InterlockedCompareExchange16.c
1 #include <Library/DebugLib.h>
2 #include "InterlockedCompareExchange16.h"
3
4 /**
5 Performs an atomic compare exchange operation on a 16-bit unsigned integer.
6
7 Performs an atomic compare exchange operation on the 16-bit unsigned integer
8 specified by Value. If Value is equal to CompareValue, then Value is set to
9 ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
10 then Value is returned. The compare exchange operation must be performed using
11 MP safe mechanisms.
12
13 If Value is NULL, then ASSERT().
14
15 @param Value A pointer to the 16-bit value for the compare exchange
16 operation.
17 @param CompareValue 16-bit value used in compare operation.
18 @param ExchangeValue 16-bit value used in exchange operation.
19
20 @return The original *Value before exchange.
21
22 **/
23 UINT16
24 EFIAPI
25 InterlockedCompareExchange16 (
26 IN OUT UINT16 *Value,
27 IN UINT16 CompareValue,
28 IN UINT16 ExchangeValue
29 )
30 {
31 ASSERT (Value != NULL);
32 return InternalSyncCompareExchange16 (Value, CompareValue, ExchangeValue);
33 }