mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01: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:
@@ -260,7 +260,7 @@ PHP_FUNCTION(abs)
|
||||
|
||||
switch (Z_TYPE_P(value)) {
|
||||
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);
|
||||
} else {
|
||||
RETURN_LONG(Z_LVAL_P(value) < 0 ? -Z_LVAL_P(value) : Z_LVAL_P(value));
|
||||
|
||||
Reference in New Issue
Block a user