]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange16.c
MdePkg: Apply uncrustify changes
[mirror_edk2.git] / MdePkg / Library / BaseSynchronizationLib / X64 / InterlockedCompareExchange16.c
CommitLineData
9b89163e
AB
1/** @file\r
2 InterlockedCompareExchange16 function\r
3\r
4cee954e 4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
9b89163e 5 Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\r
9344f092 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9b89163e
AB
7\r
8**/\r
9\r
10/**\r
11 Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics.\r
12**/\r
13\r
2f88bd3a
MK
14__int16\r
15_InterlockedCompareExchange16 (\r
16 __int16 volatile *Destination,\r
17 __int16 Exchange,\r
18 __int16 Comperand\r
19 );\r
9b89163e
AB
20\r
21#pragma intrinsic(_InterlockedCompareExchange16)\r
22\r
23/**\r
24 Performs an atomic compare exchange operation on a 16-bit unsigned integer.\r
25\r
26 Performs an atomic compare exchange operation on the 16-bit unsigned integer specified\r
27 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and\r
28 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.\r
29 The compare exchange operation must be performed using MP safe mechanisms.\r
30\r
31 @param Value A pointer to the 16-bit value for the compare exchange\r
32 operation.\r
33 @param CompareValue 16-bit value used in compare operation.\r
34 @param ExchangeValue 16-bit value used in exchange operation.\r
35\r
36 @return The original *Value before exchange.\r
37\r
38**/\r
39UINT16\r
40EFIAPI\r
41InternalSyncCompareExchange16 (\r
2f88bd3a
MK
42 IN volatile UINT16 *Value,\r
43 IN UINT16 CompareValue,\r
44 IN UINT16 ExchangeValue\r
9b89163e
AB
45 )\r
46{\r
47 return _InterlockedCompareExchange16 (Value, ExchangeValue, CompareValue);\r
48}\r