]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - sysdeps/alpha/fpu/s_lroundf.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / alpha / fpu / s_lroundf.c
index 650004dbc13eebfd4abc2cc8b54df90f1369a13b..d2c7e944280393acb5e81f2ef608199090204061 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library.  If not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #define __llroundf     not___llroundf
 #define llroundf       not_llroundf
 #include <math.h>
+#include <libm-alias-float.h>
 #undef __llroundf
 #undef llroundf
 
 long int
 __lroundf (float x)
 {
-  float adj;
+  float adj, y;
 
-  adj = 0x1.fffffep-2;         /* nextafterf (0.5f, 0.0f) */
-  adj = copysignf (adj, x);
-  return x + adj;
+  adj = copysignf (0.5f, x);
+  asm("adds/suc %1,%2,%0" : "=&f"(y) : "f"(x), "f"(adj));
+  return y;
 }
 
 strong_alias (__lroundf, __llroundf)
-weak_alias (__lroundf, lroundf)
-weak_alias (__llroundf, llroundf)
+libm_alias_float (__lround, lround)
+libm_alias_float (__llround, llround)