X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmath%2F__fpclassify.c;h=c9dd02758e5a528fc2bd0a3fcb128cd28c902e0d;hp=16051100a567ca7339034db3167a4c3156259a57;hb=b69f695acedd4ce2798ef9ea28d834ceccc789bd;hpb=d46cf2e14cc4df7cc75e77d7009fcb6df1f48a33 diff --git a/src/math/__fpclassify.c b/src/math/__fpclassify.c index 16051100..c9dd0275 100644 --- a/src/math/__fpclassify.c +++ b/src/math/__fpclassify.c @@ -1,14 +1,10 @@ -#include -#include +#include "libm.h" -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 dshape u = { x }; + int e = u.bits>>52 & 0x7ff; + if (!e) return u.bits<<1 ? FP_SUBNORMAL : FP_ZERO; + if (e==0x7ff) return u.bits<<12 ? FP_NAN : FP_INFINITE; return FP_NORMAL; }