mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
abs: Make value == ZEND_LONG_MIN
an unexpected branch
As suggested in GH-12286. This results in slightly better assembly in clang, because the expected case will be handled by a forward jump that is not taken.
This commit is contained in:
parent
865535267b
commit
9e66bc9b97
1 changed files with 1 additions and 1 deletions
|
@ -260,7 +260,7 @@ PHP_FUNCTION(abs)
|
||||||
|
|
||||||
switch (Z_TYPE_P(value)) {
|
switch (Z_TYPE_P(value)) {
|
||||||
case IS_LONG:
|
case IS_LONG:
|
||||||
if (Z_LVAL_P(value) == ZEND_LONG_MIN) {
|
if (UNEXPECTED(Z_LVAL_P(value) == ZEND_LONG_MIN)) {
|
||||||
RETURN_DOUBLE(-(double)ZEND_LONG_MIN);
|
RETURN_DOUBLE(-(double)ZEND_LONG_MIN);
|
||||||
} else {
|
} else {
|
||||||
RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value));
|
RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue