summaryrefslogtreecommitdiff
path: root/ext/gmp
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2008-01-30 18:25:51 +0000
committerIlia Alshanetsky <iliaa@php.net>2008-01-30 18:25:51 +0000
commit92ebb2e282e43697055a50c8de9bc21f57793880 (patch)
tree76f613ebc60bf0be05c498e216530874918a9875 /ext/gmp
parent1e297933868570941bd87c153b6db0e61a40a4d5 (diff)
downloadphp-git-92ebb2e282e43697055a50c8de9bc21f57793880.tar.gz
Fixed bug #43981 (gmp_div_r() does not preserve the sign of 1st argument)
Diffstat (limited to 'ext/gmp')
-rw-r--r--ext/gmp/gmp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 861ae22be8..416613d409 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -569,6 +569,9 @@ static inline void gmp_zval_binary_ui_op_ex(zval *return_value, zval **a_arg, zv
if (use_ui && gmp_ui_op) {
if (allow_ui_return) {
long_result = gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
+ if (mpz_sgn(*gmpnum_a) == -1) {
+ long_result = -long_result;
+ }
} else {
gmp_ui_op(*gmpnum_result, *gmpnum_a, (unsigned long)Z_LVAL_PP(b_arg));
}