mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
round: Make fractional == 0.5 an unexpected branch
This does indeed result in slightly better assembly for clang.
This commit is contained in:
@@ -131,7 +131,7 @@ static inline double php_round_helper(double value, int mode) {
|
||||
return integral + copysign(1.0, integral);
|
||||
}
|
||||
|
||||
if (fractional == 0.5) {
|
||||
if (UNEXPECTED(fractional == 0.5)) {
|
||||
bool even = !fmod(integral, 2.0);
|
||||
|
||||
/* If the integral part is not even we can make it even
|
||||
@@ -148,7 +148,7 @@ static inline double php_round_helper(double value, int mode) {
|
||||
return integral + copysign(1.0, integral);
|
||||
}
|
||||
|
||||
if (fractional == 0.5) {
|
||||
if (UNEXPECTED(fractional == 0.5)) {
|
||||
bool even = !fmod(integral, 2.0);
|
||||
|
||||
if (even) {
|
||||
|
||||
Reference in New Issue
Block a user