aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/fpclassify.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-04-16 16:45:59 -0700
committerElliott Hughes <enh@google.com>2014-04-16 16:45:59 -0700
commitf081e139feb56ae0cde4af6ea8176a41f2fc80d7 (patch)
tree3da21e6c8296bb8c0d2ba2ad78ae26a8945469d5 /libc/bionic/fpclassify.cpp
parent4abaa576e86e4ceaa9a18271f306787294a1cdfc (diff)
downloadandroid_bionic-f081e139feb56ae0cde4af6ea8176a41f2fc80d7.tar.gz
android_bionic-f081e139feb56ae0cde4af6ea8176a41f2fc80d7.tar.bz2
android_bionic-f081e139feb56ae0cde4af6ea8176a41f2fc80d7.zip
Switch fpclassify over to ieee_ext.
Change-Id: I441bb7f715da24e1c04b0386ad9dcde0ea8c797c
Diffstat (limited to 'libc/bionic/fpclassify.cpp')
-rw-r--r--libc/bionic/fpclassify.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/libc/bionic/fpclassify.cpp b/libc/bionic/fpclassify.cpp
index 823109327..82e1b037a 100644
--- a/libc/bionic/fpclassify.cpp
+++ b/libc/bionic/fpclassify.cpp
@@ -96,22 +96,19 @@ __strong_alias(isnanf, __isnanf);
union long_double_u {
long double ld;
- struct {
- unsigned long fracl:64;
- unsigned long frach:48;
- unsigned int exp:15;
- unsigned int sign:1;
- } bits;
+ ieee_ext bits;
};
+#define zero_frac(b) ((b.ext_fracl | b.ext_fraclm | b.ext_frachm | b.ext_frach) == 0)
+
int __fpclassifyl(long double ld) {
long_double_u u;
u.ld = ld;
- if (u.bits.exp == 0) {
- return ((u.bits.fracl | u.bits.frach) == 0) ? FP_ZERO : FP_SUBNORMAL;
+ if (u.bits.ext_exp == 0) {
+ return zero_frac(u.bits) ? FP_ZERO : FP_SUBNORMAL;
}
- if (u.bits.exp == EXT_EXP_INFNAN) {
- return ((u.bits.fracl | u.bits.frach) == 0) ? FP_INFINITE : FP_NAN;
+ if (u.bits.ext_exp == EXT_EXP_INFNAN) {
+ return zero_frac(u.bits) ? FP_INFINITE : FP_NAN;
}
return FP_NORMAL;
}