Skip to content

Commit 3964efd

Browse files
committed
ext/gmp: Use new specifier for gmp_cmp()
It seems that this also now normalizes the return value
1 parent 1e38760 commit 3964efd

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ext/gmp/gmp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,14 +1666,14 @@ ZEND_FUNCTION(gmp_kronecker)
16661666
/* {{{ Compares two numbers */
16671667
ZEND_FUNCTION(gmp_cmp)
16681668
{
1669-
zval *a_arg, *b_arg;
1669+
mpz_ptr gmpnum_a, gmpnum_b;
16701670

16711671
ZEND_PARSE_PARAMETERS_START(2, 2)
1672-
Z_PARAM_ZVAL(a_arg)
1673-
Z_PARAM_ZVAL(b_arg)
1672+
GMP_Z_PARAM_INTO_MPZ_PTR(gmpnum_a)
1673+
GMP_Z_PARAM_INTO_MPZ_PTR(gmpnum_b)
16741674
ZEND_PARSE_PARAMETERS_END();
16751675

1676-
gmp_cmp(return_value, a_arg, b_arg, /* is_operator */ false);
1676+
RETURN_LONG(mpz_cmp(gmpnum_a, gmpnum_b));
16771677
}
16781678
/* }}} */
16791679

ext/gmp/tests/gmp_cmp.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ try {
2626
echo "Done\n";
2727
?>
2828
--EXPECT--
29-
int(2)
29+
int(1)
3030
int(0)
3131
int(-1)
3232
int(0)

0 commit comments

Comments
 (0)