about summary refs log tree commit diff
path: root/sysdeps/ieee754/flt-32/s_nearbyintf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-18 15:11:31 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-18 15:11:31 -0400
commitd9a8d0abcc976f7ffe319a376ddd3497486e9726 (patch)
tree8bf41c5c082f4154657e72955711a73dff64dbea /sysdeps/ieee754/flt-32/s_nearbyintf.c
parent4855e3ddf5061dd8ddcefafc7185f6f70937434b (diff)
downloadglibc-d9a8d0abcc976f7ffe319a376ddd3497486e9726.tar.gz
glibc-d9a8d0abcc976f7ffe319a376ddd3497486e9726.tar.xz
glibc-d9a8d0abcc976f7ffe319a376ddd3497486e9726.zip
Use new internal libc_fe* interfaces in more functions
Diffstat (limited to 'sysdeps/ieee754/flt-32/s_nearbyintf.c')
-rw-r--r--sysdeps/ieee754/flt-32/s_nearbyintf.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/sysdeps/ieee754/flt-32/s_nearbyintf.c b/sysdeps/ieee754/flt-32/s_nearbyintf.c
index 7d6f262f51..04ef9ab20c 100644
--- a/sysdeps/ieee754/flt-32/s_nearbyintf.c
+++ b/sysdeps/ieee754/flt-32/s_nearbyintf.c
@@ -19,22 +19,14 @@
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
 static const float
-#else
-static float
-#endif
 TWO23[2]={
   8.3886080000e+06, /* 0x4b000000 */
  -8.3886080000e+06, /* 0xcb000000 */
 };
 
-#ifdef __STDC__
-	float __nearbyintf(float x)
-#else
-	float __nearbyintf(x)
-	float x;
-#endif
+float
+__nearbyintf(float x)
 {
 	fenv_t env;
 	int32_t i0,j0,sx;
@@ -50,13 +42,13 @@ TWO23[2]={
 		i0 &= 0xfff00000;
 		i0 |= ((i1|-i1)>>9)&0x400000;
 		SET_FLOAT_WORD(x,i0);
-		feholdexcept (&env);
-	        w = TWO23[sx]+x;
-	        t =  w-TWO23[sx];
-		fesetenv (&env);
+		libc_feholdexceptf (&env);
+		w = TWO23[sx]+x;
+		t =  w-TWO23[sx];
+		libc_fesetenvf (&env);
 		GET_FLOAT_WORD(i0,t);
 		SET_FLOAT_WORD(t,(i0&0x7fffffff)|(sx<<31));
-	        return t;
+		return t;
 	    } else {
 		i = (0x007fffff)>>j0;
 		if((i0&i)==0) return x; /* x is integral */
@@ -64,14 +56,14 @@ TWO23[2]={
 		if((i0&i)!=0) i0 = (i0&(~i))|((0x100000)>>j0);
 	    }
 	} else {
-	    if(j0==0x80) return x+x;	/* inf or NaN */
+	    if(__builtin_expect(j0==0x80, 0)) return x+x;	/* inf or NaN */
 	    else return x;		/* x is integral */
 	}
 	SET_FLOAT_WORD(x,i0);
-	feholdexcept (&env);
+	libc_feholdexceptf (&env);
 	w = TWO23[sx]+x;
 	t = w-TWO23[sx];
-	fesetenv (&env);
+	libc_fesetenvf (&env);
 	return t;
 }
 weak_alias (__nearbyintf, nearbyintf)