]> granicus.if.org Git - libatomic_ops/commitdiff
Enable double_compare_and_swap for non-cpp code (msftc/x86.h)
authorIvan Maidanski <ivmai@mail.ru>
Fri, 5 Oct 2012 09:59:01 +0000 (13:59 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 5 Oct 2012 09:59:01 +0000 (13:59 +0400)
* src/atomic_ops/sysdeps/msftc/x86.h (AO_double_compare_and_swap_full,
AO_HAVE_double_compare_and_swap_full): Define even if no __cplusplus;
define before compare_double_and_swap_double.

src/atomic_ops/sysdeps/msftc/x86.h

index 0265592213be9a3472056913a9cad1a85156f9ab..6919c68f1de39de637a6d6bd6777d0ca383a447d 100644 (file)
@@ -85,13 +85,22 @@ AO_test_and_set_full(volatile AO_TS_t *addr)
 #endif
 
 #ifdef AO_ASSUME_VISTA
+# include "../standard_ao_double_t.h"
 
-/* NEC LE-IT: whenever we run on a pentium class machine we have that
- * certain function */
+  /* Whenever we run on a Pentium class machine, we have that certain   */
+  /* function.                                                          */
+# pragma intrinsic (_InterlockedCompareExchange64)
+
+  /* Returns nonzero if the comparison succeeded.       */
+  AO_INLINE int
+  AO_double_compare_and_swap_full(volatile AO_double_t *addr,
+                                  AO_double_t old_val, AO_double_t new_val)
+  {
+    return _InterlockedCompareExchange64((__int64 volatile *)addr,
+                new_val.AO_whole, old_val.AO_whole) == old_val.AO_whole;
+  }
+# define AO_HAVE_double_compare_and_swap_full
 
-#include "../standard_ao_double_t.h"
-#pragma intrinsic (_InterlockedCompareExchange64)
-/* Returns nonzero if the comparison succeeded. */
 AO_INLINE int
 AO_compare_double_and_swap_double_full(volatile AO_double_t *addr,
                                        AO_t old_val1, AO_t old_val2,
@@ -104,17 +113,6 @@ AO_compare_double_and_swap_double_full(volatile AO_double_t *addr,
 }
 #define AO_HAVE_compare_double_and_swap_double_full
 
-#ifdef __cplusplus
-AO_INLINE int
-AO_double_compare_and_swap_full(volatile AO_double_t *addr,
-                                AO_double_t old_val, AO_double_t new_val)
-{
-    return _InterlockedCompareExchange64((__int64 volatile *)addr,
-                new_val.AO_whole, old_val.AO_whole) == old_val.AO_whole;
-}
-#define AO_HAVE_double_compare_and_swap_full
-#endif /* __cplusplus */
-
 #endif /* AO_ASSUME_VISTA */
 
 #define AO_T_IS_INT