diff options
author | Richard Henderson <rth@twiddle.net> | 2012-03-09 12:38:23 -0800 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2012-03-19 06:47:43 -0700 |
commit | 4851a949b4cd1f280b56a728c784aaa85e51124c (patch) | |
tree | 331199de9e22e6be357e697a035fb255d89f62e3 /sysdeps/ieee754 | |
parent | e79d442ee64ef2426ddd29a1fe1174108e845b69 (diff) | |
download | glibc-4851a949b4cd1f280b56a728c784aaa85e51124c.tar.gz glibc-4851a949b4cd1f280b56a728c784aaa85e51124c.tar.xz glibc-4851a949b4cd1f280b56a728c784aaa85e51124c.zip |
Make inline __isnan, __isinf_ns, __finite generic.
For code generation to stay identical on x86_64, this requires that we define the fp word manipulation macros before including the generic header.
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r-- | sysdeps/ieee754/dbl-64/wordsize-64/math_private.h | 35 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/math_private.h | 35 |
2 files changed, 70 insertions, 0 deletions
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/math_private.h b/sysdeps/ieee754/dbl-64/wordsize-64/math_private.h new file mode 100644 index 0000000000..b66085eb1b --- /dev/null +++ b/sysdeps/ieee754/dbl-64/wordsize-64/math_private.h @@ -0,0 +1,35 @@ +#ifndef _MATH_PRIVATE_H_ + +#include_next <math_private.h> + +#ifndef __isnan +extern __always_inline int +__isnan (double d) +{ + uint64_t di; + EXTRACT_WORDS64 (di, d); + return (di & 0x7fffffffffffffffull) > 0x7ff0000000000000ull; +} +#endif + +#ifndef __isinf_ns +extern __always_inline int +__isinf_ns (double d) +{ + uint64_t di; + EXTRACT_WORDS64 (di, d); + return (di & 0x7fffffffffffffffull) == 0x7ff0000000000000ull; +} +#endif + +#ifndef __finite +extern __always_inline int +__finite (double d) +{ + uint64_t di; + EXTRACT_WORDS64 (di, d); + return (di & 0x7fffffffffffffffull) < 0x7ff0000000000000ull; +} +#endif + +#endif /* _MATH_PRIVATE_H_ */ diff --git a/sysdeps/ieee754/flt-32/math_private.h b/sysdeps/ieee754/flt-32/math_private.h new file mode 100644 index 0000000000..e33db02b4c --- /dev/null +++ b/sysdeps/ieee754/flt-32/math_private.h @@ -0,0 +1,35 @@ +#ifndef _MATH_PRIVATE_H_ + +#include_next <math_private.h> + +#ifndef __isnanf +extern __always_inline int +__isnanf (float d) +{ + u_int32_t di; + GET_FLOAT_WORD (di, d); + return (di & 0x7fffffff) > 0x7f800000; +} +#endif + +#ifndef __isinf_nsf +extern __always_inline int +__isinf_nsf (float d) +{ + u_int32_t di; + GET_FLOAT_WORD (di, d); + return (di & 0x7fffffff) == 0x7f800000; +} +#endif + +#ifndef __finitef +extern __always_inline int +__finitef (float d) +{ + u_int32_t di; + GET_FLOAT_WORD (di, d); + return (di & 0x7fffffff) < 0x7f800000; +} +#endif + +#endif /* _MATH_PRIVATE_H_ */ |