mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-10 14:02:43 +00:00
Optimize the fixup for +-0 by using better classification for this case
and by using a table lookup to avoid a branch when this case occurs. On i386, this saves 1-4 cycles out of about 64 for non-large args.
This commit is contained in:
parent
da9b9cd9dc
commit
a7aa8cc980
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176458
@ -44,6 +44,7 @@ shift[2] = {
|
||||
#error "Unsupported long double format"
|
||||
#endif
|
||||
};
|
||||
static const float zero[2] = { 0.0, -0.0 };
|
||||
|
||||
long double
|
||||
rintl(long double x)
|
||||
@ -74,7 +75,8 @@ rintl(long double x)
|
||||
* If the result is +-0, then it must have the same sign as x, but
|
||||
* the above calculation doesn't always give this. Fix up the sign.
|
||||
*/
|
||||
if (x == 0.0L)
|
||||
return (sign ? -0.0L : 0.0L);
|
||||
if (u.bits.exp < BIAS && x == 0.0L)
|
||||
return (zero[sign]);
|
||||
|
||||
return (x);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user