From daa891c0e8900d0f03c16fde9c09f8d6f9a26a7d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 10 Jan 2012 22:26:22 -0500 Subject: Optimize s_modf --- sysdeps/ieee754/ldbl-96/s_modfl.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'sysdeps/ieee754/ldbl-96/s_modfl.c') diff --git a/sysdeps/ieee754/ldbl-96/s_modfl.c b/sysdeps/ieee754/ldbl-96/s_modfl.c index 99c0752efa..c7659119f3 100644 --- a/sysdeps/ieee754/ldbl-96/s_modfl.c +++ b/sysdeps/ieee754/ldbl-96/s_modfl.c @@ -14,10 +14,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - /* * modfl(long double x, long double *iptr) * return fraction part of x, and return x's integral part in *iptr. @@ -31,18 +27,10 @@ static char rcsid[] = "$NetBSD: $"; #include "math.h" #include "math_private.h" -#ifdef __STDC__ static const long double one = 1.0; -#else -static long double one = 1.0; -#endif -#ifdef __STDC__ - long double __modfl(long double x, long double *iptr) -#else - long double __modfl(x, iptr) - long double x,*iptr; -#endif +long double +__modfl(long double x, long double *iptr) { int32_t i0,i1,j0; u_int32_t i,se; @@ -50,7 +38,7 @@ static long double one = 1.0; j0 = (se&0x7fff)-0x3fff; /* exponent of x */ if(j0<32) { /* integer part in high x */ if(j0<0) { /* |x|<1 */ - SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0); /* *iptr = +-0 */ + SET_LDOUBLE_WORDS(*iptr,se&0x8000,0,0); /* *iptr = +-0 */ return x; } else { i = (0x7fffffff)>>j0; @@ -63,7 +51,7 @@ static long double one = 1.0; return x - *iptr; } } - } else if (j0>63) { /* no fraction part */ + } else if (__builtin_expect(j0>63, 0)) { /* no fraction part */ *iptr = x*one; /* We must handle NaNs separately. */ if (j0 == 0x4000 && ((i0 & 0x7fffffff) | i1)) -- cgit 1.4.1