diff scripts/hvresources/HvUtils.h @ 504:b6eb94378ca9 prerelease

update_board
author Giulio Moro <giuliomoro@yahoo.it>
date Wed, 22 Jun 2016 01:24:55 +0100
parents 9e5156589124
children
line wrap: on
line diff
--- a/scripts/hvresources/HvUtils.h	Wed Jun 22 01:17:57 2016 +0100
+++ b/scripts/hvresources/HvUtils.h	Wed Jun 22 01:24:55 2016 +0100
@@ -42,6 +42,7 @@
 #include <stdint.h>
 #include <stdbool.h>
 #define hv_size_t size_t
+#define hv_uint64_t uint64_t
 #define hv_uint32_t uint32_t
 #define hv_int32_t int32_t
 #define hv_uint16_t uint16_t
@@ -172,8 +173,7 @@
       #define hv_malloc(_n) memalign(16, _n)
       #define hv_free(x) free(x)
     #else
-      //#define hv_malloc(_n) aligned_alloc(16, _n)
-      #define hv_malloc(_n) memalign(16, _n)
+      #define hv_malloc(_n) aligned_alloc(16, _n)
       #define hv_free(x) free(x)
     #endif
   #else // HV_SIMD_NONE
@@ -261,9 +261,10 @@
 #define HV_SPINLOCK_ACQUIRE(_x) \
 while (InterlockedCompareExchange(&_x, true, false)) { }
 #define HV_SPINLOCK_RELEASE(_x) (_x = false)
-#elif defined(__has_include)
-#if __has_include(<stdatomic.h>)
+#elif __cplusplus || __has_include(<stdatomic.h>)
+#if !__cplusplus
 #include <stdatomic.h>
+#endif
 #define hv_atomic_bool volatile atomic_bool
 #define HV_SPINLOCK_ACQUIRE(_x) \
 bool expected = false; \
@@ -274,11 +275,5 @@
 #define HV_SPINLOCK_ACQUIRE(_x) _x = true;
 #define HV_SPINLOCK_RELEASE(_x) _x = false;
 #endif
-#else
-#define hv_atomic_bool volatile bool
-#define HV_SPINLOCK_ACQUIRE(_x) _x = true;
-#define HV_SPINLOCK_RELEASE(_x) _x = false;
-#endif
-
 
 #endif // _HEAVY_UTILS_H_