]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/BaseSynchronizationLib/X64/InterlockedCompareExchange64.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseSynchronizationLib / X64 / InterlockedCompareExchange64.c
... / ...
CommitLineData
1/** @file\r
2 InterlockedCompareExchange64 function\r
3\r
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
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
13__int64 _InterlockedCompareExchange64(\r
14 __int64 volatile * Destination,\r
15 __int64 Exchange,\r
16 __int64 Comperand\r
17);\r
18\r
19#pragma intrinsic(_InterlockedCompareExchange64)\r
20\r
21/**\r
22 Performs an atomic compare exchange operation on a 64-bit unsigned integer.\r
23\r
24 Performs an atomic compare exchange operation on the 64-bit unsigned integer specified\r
25 by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and\r
26 CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.\r
27 The compare exchange operation must be performed using MP safe mechanisms.\r
28\r
29 @param Value A pointer to the 64-bit value for the compare exchange\r
30 operation.\r
31 @param CompareValue 64-bit value used in compare operation.\r
32 @param ExchangeValue 64-bit value used in exchange operation.\r
33\r
34 @return The original *Value before exchange.\r
35\r
36**/\r
37UINT64\r
38EFIAPI\r
39InternalSyncCompareExchange64 (\r
40 IN volatile UINT64 *Value,\r
41 IN UINT64 CompareValue,\r
42 IN UINT64 ExchangeValue\r
43 )\r
44{\r
45 return _InterlockedCompareExchange64 (Value, ExchangeValue, CompareValue);\r
46}\r
47\r