summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
authorMarc Alexander Lehmann <libev@schmorp.de>2014-01-05 02:59:36 +0000
committerMarc Alexander Lehmann <libev@schmorp.de>2014-01-05 02:59:36 +0000
commit866562b42d901b2cfdfeea4b16a0b004b5f35c08 (patch)
treec3d7957406cb79a32a8ac9d4052e8760f1286d94 /ev.c
parentc4bba4548e38ec99cc93fcdb2dd753dc8f54c9d8 (diff)
downloadlibev-866562b42d901b2cfdfeea4b16a0b004b5f35c08.tar.gz
libev-866562b42d901b2cfdfeea4b16a0b004b5f35c08.zip
*** empty log message ***
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/ev.c b/ev.c
index c719b2f..fbe5aeb 100644
--- a/ev.c
+++ b/ev.c
@@ -484,7 +484,7 @@ struct signalfd_siginfo
/*
* libecb - http://software.schmorp.de/pkg/libecb
*
- * Copyright (©) 2009-2012 Marc Alexander Lehmann <libecb@schmorp.de>
+ * Copyright (©) 2009-2013 Marc Alexander Lehmann <libecb@schmorp.de>
* Copyright (©) 2011 Emanuele Giaquinta
* All rights reserved.
*
@@ -549,7 +549,7 @@ struct signalfd_siginfo
#endif
/* work around x32 idiocy by defining proper macros */
-#if __x86_64 || _M_AMD64
+#if __amd64 || __x86_64 || _M_AMD64 || _M_X64
#if _ILP32
#define ECB_AMD64_X32 1
#else
@@ -619,7 +619,7 @@ struct signalfd_siginfo
#elif defined __ARM_ARCH_7__ || defined __ARM_ARCH_7A__ \
|| defined __ARM_ARCH_7M__ || defined __ARM_ARCH_7R__
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb" : : : "memory")
- #elif __sparc || __sparc__
+ #elif (__sparc || __sparc__) && !__sparcv8
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad" : : : "memory")
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory")
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore")
@@ -662,6 +662,12 @@ struct signalfd_siginfo
#elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__
#define ECB_MEMORY_FENCE __sync_synchronize ()
+ #elif _MSC_VER >= 1500 /* VC++ 2008 */
+ /* apparently, microsoft broke all the memory barrier stuff in Visual Studio 2008... */
+ #pragma intrinsic(_ReadBarrier,_WriteBarrier,_ReadWriteBarrier)
+ #define ECB_MEMORY_FENCE _ReadWriteBarrier (); MemoryBarrier()
+ #define ECB_MEMORY_FENCE_ACQUIRE _ReadWriteBarrier (); MemoryBarrier() /* according to msdn, _ReadBarrier is not a load fence */
+ #define ECB_MEMORY_FENCE_RELEASE _WriteBarrier (); MemoryBarrier()
#elif _MSC_VER >= 1400 /* VC++ 2005 */
#pragma intrinsic(_ReadBarrier,_WriteBarrier,_ReadWriteBarrier)
#define ECB_MEMORY_FENCE _ReadWriteBarrier ()
@@ -1072,10 +1078,17 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
#include <math.h> /* for frexp*, ldexp*, INFINITY, NAN */
- #ifdef NEN
+ /* only the oldest of old doesn't have this one. solaris. */
+ #ifdef INFINITY
+ #define ECB_INFINITY INFINITY
+ #else
+ #define ECB_INFINITY HUGE_VAL
+ #endif
+
+ #ifdef NAN
#define ECB_NAN NAN
#else
- #define ECB_NAN INFINITY
+ #define ECB_NAN ECB_INFINITY
#endif
/* converts an ieee half/binary16 to a float */
@@ -1090,7 +1103,7 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
if (!e ) r = ldexpf (m , -24);
else if (e != 31) r = ldexpf (m + 0x400, e - 25);
else if (m ) r = ECB_NAN;
- else r = INFINITY;
+ else r = ECB_INFINITY;
return x & 0x8000 ? -r : r;
}