From 5d53cce4c05d1f4f730cce080233dc959f773059 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 11 Feb 2009 17:37:21 +0000 Subject: docs/probe_math_exception.c: update example libc/sysdeps/linux/i386/bits/mathinline.h: improve __finite() macro, add __finitef macro (why they aren't always macros? why aren't they arch independent?) libm/math_private.h: much better comments on math_opt_barrier() and math_force_eval() libm/s_finite[f].c: improve out-of-line __finite[f]() too (one byte less, yay...) --- libc/sysdeps/linux/i386/bits/mathinline.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'libc/sysdeps') diff --git a/libc/sysdeps/linux/i386/bits/mathinline.h b/libc/sysdeps/linux/i386/bits/mathinline.h index ca7277d76..5caf73353 100644 --- a/libc/sysdeps/linux/i386/bits/mathinline.h +++ b/libc/sysdeps/linux/i386/bits/mathinline.h @@ -713,11 +713,22 @@ __inline_mathcodeNP2 (drem, __x, __y, \ __MATH_INLINE int __NTH (__finite (double __x)) { - return (__extension__ - (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1] - | 0x800fffffu) + 1) >> 31)); + union { double __d; int __i[2]; } u; + u.__d = __x; + /* Finite numbers have at least one zero bit in exponent. */ + /* All other numbers will result in 0xffffffff after OR: */ + return (u.__i[1] | 0x800fffff) != 0xffffffff; } +__MATH_INLINE int +__NTH (__finitef (float __x)) +{ + union { float __d; int __i; } u; + u.__d = __x; + return (u.__i | 0x807fffff) != 0xffffffff; +} + + /* Miscellaneous functions */ # ifdef __FAST_MATH__ __inline_mathcode (__coshm1, __x, \ -- cgit v1.2.3