1
0
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:
Tim Düsterhus
2023-09-24 16:50:53 +02:00
parent 4834e7ede5
commit 865535267b

View File

@@ -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) {