diff options
author | Andreas Schwab <schwab@linux-m68k.org> | 2012-05-25 11:57:33 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@linux-m68k.org> | 2012-05-26 13:53:22 +0200 |
commit | 25dbcb277a9dea5f241c0b888a30b9341310d941 (patch) | |
tree | 74c7933f325f44fed6f2f15fd87c59fd4752be37 /sysdeps/ieee754/dbl-64/s_logb.c | |
parent | d81dcb356909937b0c8e9c69ff0be27f51aaa07a (diff) | |
download | glibc-25dbcb277a9dea5f241c0b888a30b9341310d941.tar.gz |
Optimize handling of denormals in logb/logbf/logbl
Diffstat (limited to 'sysdeps/ieee754/dbl-64/s_logb.c')
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_logb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_logb.c b/sysdeps/ieee754/dbl-64/s_logb.c index baa35e14d8..17aa94b755 100644 --- a/sysdeps/ieee754/dbl-64/s_logb.c +++ b/sysdeps/ieee754/dbl-64/s_logb.c @@ -34,10 +34,12 @@ __logb (double x) { /* POSIX specifies that denormal number is treated as though it were normalized. */ - int m1 = (ix == 0) ? 0 : __builtin_clz (ix); - int m2 = (lx == 0) ? 0 : __builtin_clz (lx); - int ma = (m1 == 0) ? m2 + 32 : m1; - return -1022.0 + (double)(11 - ma); + int ma; + if (ix == 0) + ma = __builtin_clz (lx) + 32; + else + ma = __builtin_clz (ix); + rix -= ma - 12; } return (double) (rix - 1023); } |