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