]> rtime.felk.cvut.cz Git - sojka/libev.git/commitdiff
*** empty log message ***
authorMarc Alexander Lehmann <libev@schmorp.de>
Sun, 27 Oct 2013 16:26:07 +0000 (16:26 +0000)
committerMarc Alexander Lehmann <libev@schmorp.de>
Sun, 27 Oct 2013 16:26:07 +0000 (16:26 +0000)
Changes
ev.c

diff --git a/Changes b/Changes
index dbd62f9ecd4389d3fb4c198e8d7d318e3290057e..6c43ec5ed538549028008f790c991a3e39839172 100644 (file)
--- 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 fb3e7048546f2dd42c95e2a2c107f32123a7d97e..5ba6e606997c2d69371d240c579ca9e93ca8f4aa 100644 (file)
--- 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