X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2F__fpclassify.c;h=f7c0e2dfac828616b43f76664c6821de1b348f8d;hb=b1dfb734a45d4f74c7a24c5f07d37f7e74451802;hp=16051100a567ca7339034db3167a4c3156259a57;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl diff --git a/src/math/__fpclassify.c b/src/math/__fpclassify.c index 16051100..f7c0e2df 100644 --- a/src/math/__fpclassify.c +++ b/src/math/__fpclassify.c @@ -1,14 +1,11 @@ -#include #include +#include -int __fpclassify(double __x) +int __fpclassify(double x) { - union { - double __d; - __uint64_t __i; - } __y = { __x }; - int __ee = __y.__i>>52 & 0x7ff; - if (!__ee) return __y.__i<<1 ? FP_SUBNORMAL : FP_ZERO; - if (__ee==0x7ff) return __y.__i<<12 ? FP_NAN : FP_INFINITE; + union {double f; uint64_t i;} u = {x}; + int e = u.i>>52 & 0x7ff; + if (!e) return u.i<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0x7ff) return u.i<<12 ? FP_NAN : FP_INFINITE; return FP_NORMAL; }