mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
alpha: Fix lround implementations
Use chopped rounding to add 0.5.
This commit is contained in:
parent
cd1175a373
commit
ca7b945c73
@ -1,5 +1,8 @@
|
||||
2014-07-03 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* sysdeps/alpha/fpu/s_lround.c: Add 0.5 with chopped rounding.
|
||||
* sysdeps/alpha/fpu/s_lroundf.c: Likewise.
|
||||
|
||||
* sysdeps/alpha/fpu/s_round.c: Remove file.
|
||||
* sysdeps/alpha/fpu/s_roundf.c: Remove file.
|
||||
|
||||
|
@ -25,11 +25,11 @@
|
||||
long int
|
||||
__lround (double x)
|
||||
{
|
||||
double adj;
|
||||
double adj, y;
|
||||
|
||||
adj = 0x1.fffffffffffffp-2; /* nextafter (0.5, 0.0) */
|
||||
adj = copysign (adj, x);
|
||||
return x + adj;
|
||||
adj = copysign (0.5, x);
|
||||
asm("addt/suc %1,%2,%0" : "=&f"(y) : "f"(x), "f"(adj));
|
||||
return y;
|
||||
}
|
||||
|
||||
strong_alias (__lround, __llround)
|
||||
|
@ -25,11 +25,11 @@
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user