Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
3.6 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. winbase_interlockedcplusplus.h
  5. Abstract:
  6. C++ function overloads in place of "manual name mangling".
  7. Author:
  8. Jay Krell (JayKrell) April 2002
  9. Environment:
  10. Revision History:
  11. --*/
  12. #if !defined(MICROSOFT_WINDOWS_WINBASE_INTERLOCKED_CPLUSPLUS_H_INCLUDED) /* { */
  13. #define MICROSOFT_WINDOWS_WINBASE_INTERLOCKED_CPLUSPLUS_H_INCLUDED
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #if !defined(RC_INVOKED) /* { */
  18. #if !defined(MIDL_PASS) /* { */
  19. #if !defined(MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS)
  20. #define MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS (_WIN32_WINNT >= 0x0502 || !defined(_WINBASE_))
  21. #endif
  22. #if MICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS /* { */
  23. #if defined(__cplusplus) /* { */
  24. extern "C++" {
  25. FORCEINLINE
  26. ULONG
  27. InterlockedIncrement(
  28. IN OUT ULONG volatile *Addend
  29. )
  30. {
  31. return InterlockedIncrementUlong(Addend);
  32. }
  33. FORCEINLINE
  34. ULONGLONG
  35. InterlockedIncrement(
  36. IN OUT ULONGLONG volatile *Addend
  37. )
  38. {
  39. return InterlockedIncrementUnsigned64(Addend);
  40. }
  41. FORCEINLINE
  42. ULONG
  43. InterlockedDecrement(
  44. IN OUT ULONG volatile *Addend
  45. )
  46. {
  47. return InterlockedDecrementUlong(Addend);
  48. }
  49. FORCEINLINE
  50. ULONGLONG
  51. InterlockedDecrement(
  52. IN OUT ULONGLONG volatile *Addend
  53. )
  54. {
  55. return InterlockedDecrementUnsigned64(Addend);
  56. }
  57. FORCEINLINE
  58. ULONG
  59. InterlockedExchange(
  60. IN OUT ULONG volatile *Target,
  61. IN ULONG Value
  62. )
  63. {
  64. return InterlockedExchangeUlong(Target, Value);
  65. }
  66. FORCEINLINE
  67. ULONGLONG
  68. InterlockedExchange(
  69. IN OUT ULONGLONG volatile *Target,
  70. IN ULONGLONG Value
  71. )
  72. {
  73. return InterlockedExchangeUnsigned64(Target, Value);
  74. }
  75. FORCEINLINE
  76. ULONG
  77. InterlockedExchangeAdd(
  78. IN OUT ULONG volatile *Addend,
  79. IN ULONG Value
  80. )
  81. {
  82. return InterlockedExchangeAddUlong(Addend, Value);
  83. }
  84. FORCEINLINE
  85. ULONGLONG
  86. InterlockedExchangeAdd(
  87. IN OUT ULONGLONG volatile *Addend,
  88. IN ULONGLONG Value
  89. )
  90. {
  91. return InterlockedExchangeAddUnsigned64(Addend, Value);
  92. }
  93. FORCEINLINE
  94. ULONG
  95. InterlockedCompareExchange (
  96. IN OUT ULONG volatile *Destination,
  97. IN ULONG Exchange,
  98. IN ULONG Comperand
  99. )
  100. {
  101. return InterlockedCompareExchangeUlong(Destination, Exchange, Comperand);
  102. }
  103. FORCEINLINE
  104. ULONGLONG
  105. InterlockedCompareExchange (
  106. IN OUT ULONGLONG volatile *Destination,
  107. IN ULONGLONG Exchange,
  108. IN ULONGLONG Comperand
  109. )
  110. {
  111. return InterlockedCompareExchangeUnsigned64(Destination, Exchange, Comperand);
  112. }
  113. FORCEINLINE
  114. ULONGLONG
  115. InterlockedAnd (
  116. IN OUT ULONGLONG volatile *Destination,
  117. IN ULONGLONG Value
  118. )
  119. {
  120. return InterlockedAndUnsigned64(Destination, Value);
  121. }
  122. FORCEINLINE
  123. ULONGLONG
  124. InterlockedOr (
  125. IN OUT ULONGLONG volatile *Destination,
  126. IN ULONGLONG Value
  127. )
  128. {
  129. return InterlockedOrUnsigned64(Destination, Value);
  130. }
  131. FORCEINLINE
  132. ULONGLONG
  133. InterlockedXor (
  134. IN OUT ULONGLONG volatile *Destination,
  135. IN ULONGLONG Value
  136. )
  137. {
  138. return InterlockedXorUnsigned64(Destination, Value);
  139. }
  140. } /* extern "C++" */
  141. #endif /* } __cplusplus */
  142. #endif /* } MICROSOFT_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS */
  143. #undef MICROSOFT_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS
  144. #define MICROSOFT_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS 0
  145. #endif /* } MIDL_PASS */
  146. #endif /* } RC_INVOKED */
  147. #endif /* } MICROSOFT_WINDOWS_WINBASE_INTERLOCKED_CPLUSPLUS_H_INCLUDED */