Skip to content

Commit 5b86f5d

Browse files
committed
Inital review feedback
- remove the zend_always_inline - use INT_MIN instead of -INT_MAX - use % matching in the tests so they work on 32bit
1 parent 89e383d commit 5b86f5d

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

ext/bcmath/bcmath.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ static zend_always_inline zend_result bcmath_check_scale(zend_long scale, uint32
155155
return SUCCESS;
156156
}
157157

158-
static zend_always_inline zend_result bcmath_check_precision(zend_long precision, uint32_t arg_num)
158+
static zend_result bcmath_check_precision(zend_long precision, uint32_t arg_num)
159159
{
160-
if (UNEXPECTED(precision < -(zend_long) INT_MAX || precision > INT_MAX)) {
161-
zend_argument_value_error(arg_num, "must be between %d and %d", -INT_MAX, INT_MAX);
160+
if (UNEXPECTED(precision < INT_MIN || precision > INT_MAX)) {
161+
zend_argument_value_error(arg_num, "must be between %d and %d", INT_MIN, INT_MAX);
162162
return FAILURE;
163163
}
164164
return SUCCESS;

ext/bcmath/tests/bcround_precision_bounds.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ try {
2525
echo $e->getMessage() . \PHP_EOL;
2626
}
2727
?>
28-
--EXPECT--
29-
bcround(): Argument #2 ($precision) must be between -2147483647 and 2147483647
30-
bcround(): Argument #2 ($precision) must be between -2147483647 and 2147483647
31-
bcround(): Argument #2 ($precision) must be between -2147483647 and 2147483647
32-
BcMath\Number::round(): Argument #1 ($precision) must be between -2147483647 and 2147483647
28+
--EXPECTF--
29+
bcround(): Argument #2 ($precision) must be between %i and %i
30+
bcround(): Argument #2 ($precision) must be between %i and %i
31+
bcround(): Argument #2 ($precision) must be between %i and %i
32+
BcMath\Number::round(): Argument #1 ($precision) must be between %i and %i

0 commit comments

Comments
 (0)