about summary refs log tree commit diff
path: root/sysdeps/ieee754/dbl-64
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-09-17 16:47:14 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-09-17 16:47:14 +0000
commitb8682397ab2db1aed7f25d0a0c7c81134a97c8c7 (patch)
tree76b6a9cbc7456f7ee53fe40cc86e0c7fe5e87f7a /sysdeps/ieee754/dbl-64
parent46f74e1deee549b41160d353ce0c8f7db555d36c (diff)
downloadglibc-b8682397ab2db1aed7f25d0a0c7c81134a97c8c7.tar.gz
glibc-b8682397ab2db1aed7f25d0a0c7c81134a97c8c7.tar.xz
glibc-b8682397ab2db1aed7f25d0a0c7c81134a97c8c7.zip
Reduce number of constants in __finite* (bug 15384).
Bug 15384 notes that in __finite, two different constants are used
that could be the same constant (the result only depends on the
exponent of the floating-point representation), and that using the
same constant is better for architectures where constants need loading
from a constant pool.  This patch implements that change.

Tested for x86_64, mips64 and powerpc.

	[BZ #15384]
	* sysdeps/ieee754/dbl-64/s_finite.c (FINITE): Use same constant as
	bit-mask as in subtraction.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c (__finite):
	Likewise.
	* sysdeps/ieee754/flt-32/s_finitef.c (FINITEF): Likewise.
	* sysdeps/ieee754/ldbl-128/s_finitel.c (__finitel): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/s_finitel.c (__finitel): Likewise.
Diffstat (limited to 'sysdeps/ieee754/dbl-64')
-rw-r--r--sysdeps/ieee754/dbl-64/s_finite.c2
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c
index 49986bbde9..2b0ed504f9 100644
--- a/sysdeps/ieee754/dbl-64/s_finite.c
+++ b/sysdeps/ieee754/dbl-64/s_finite.c
@@ -32,7 +32,7 @@ int FINITE(double x)
 {
   int32_t hx;
   GET_HIGH_WORD (hx, x);
-  return (int) ((u_int32_t) ((hx & 0x7fffffff) - 0x7ff00000) >> 31);
+  return (int) ((u_int32_t) ((hx & 0x7ff00000) - 0x7ff00000) >> 31);
 }
 hidden_def (__finite)
 weak_alias (__finite, finite)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
index fcf2e6d5b6..a155a5e1ef 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
@@ -24,7 +24,7 @@ __finite(double x)
 {
   int64_t lx;
   EXTRACT_WORDS64(lx,x);
-  return (int)((uint64_t)((lx&INT64_C(0x7fffffffffffffff))-INT64_C(0x7ff0000000000000))>>63);
+  return (int)((uint64_t)((lx&INT64_C(0x7ff0000000000000))-INT64_C(0x7ff0000000000000))>>63);
 }
 hidden_def (__finite)
 weak_alias (__finite, finite)