summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--ev.c30
2 files changed, 28 insertions, 3 deletions
diff --git a/Changes b/Changes
index dbd62f9..6c43ec5 100644
--- a/Changes
+++ b/Changes
@@ -13,6 +13,7 @@ TODO: store loop pid_t and compare isndie signal handler,store 1 for same, 2 for
TODO: embed watchers need updating when fd changes
TODO: document portbaility requirements for atomic pointer access
+TODO: glibc >=2.17 do not need -lrt for clock_xxx
- mark event pipe fd as cloexec after a fork (analyzed by Sami Farin).
- (ecb) support m68k, m88k and sh (patch by Miod Vallat).
diff --git a/ev.c b/ev.c
index fb3e704..5ba6e60 100644
--- a/ev.c
+++ b/ev.c
@@ -553,7 +553,7 @@ struct signalfd_siginfo
/* work around x32 idiocy by defining proper macros */
#if __x86_64 || _M_AMD64
- #if __ILP32
+ #if _ILP32
#define ECB_AMD64_X32 1
#else
#define ECB_AMD64 1
@@ -629,7 +629,7 @@ struct signalfd_siginfo
#elif defined __s390__ || defined __s390x__
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("bcr 15,0" : : : "memory")
#elif defined __mips__
- /* GNU/Linux emulates sync on mips1 architectures, so we force it's use */
+ /* GNU/Linux emulates sync on mips1 architectures, so we force its use */
/* anybody else who still uses mips1 is supposed to send in their version, with detection code. */
#define ECB_MEMORY_FENCE __asm__ __volatile__ (".set mips2; sync; .set mips0" : : : "memory")
#elif defined __alpha__
@@ -1069,11 +1069,35 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
#include <string.h> /* for memcpy */
#else
#define ECB_STDFP 0
- #include <math.h> /* for frexp*, ldexp* */
#endif
#ifndef ECB_NO_LIBM
+ #include <math.h> /* for frexp*, ldexp*, INFINITY, NAN */
+
+ #ifdef NEN
+ #define ECB_NAN NAN
+ #else
+ #define ECB_NAN INFINITY
+ #endif
+
+ /* converts an ieee half/binary16 to a float */
+ ecb_function_ float ecb_binary16_to_float (uint16_t x) ecb_const;
+ ecb_function_ float
+ ecb_binary16_to_float (uint16_t x)
+ {
+ int e = (x >> 10) & 0x1f;
+ int m = x & 0x3ff;
+ float r;
+
+ 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;
+
+ return x & 0x8000 ? -r : r;
+ }
+
/* convert a float to ieee single/binary32 */
ecb_function_ uint32_t ecb_float_to_binary32 (float x) ecb_const;
ecb_function_ uint32_t