-/* 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)