php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #52906
Patch gmp_mod revision 2010-09-22 15:43 UTC by cataphract@php.net

Patch gmp_mod for GNU MP related Bug #52906

Patch version 2010-09-22 15:43 UTC

Return to Bug #52906 | Download this patch
Patch Revisions:

Developer: cataphract@php.net

Index: gmp.c
===================================================================
--- gmp.c	(revision 302109)
+++ gmp.c	(working copy)
@@ -955,7 +955,9 @@
 		return;
 	}
 
-	gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_mod, (gmp_binary_ui_op_t)mpz_mod_ui, 1, 1 TSRMLS_CC);
+	/* Don't use ui variant because gmp_zval_binary_ui_op_ex would attempt to change
+	 * the sign of the result if the first operand was negative */
+	gmp_zval_binary_ui_op_ex(return_value, a_arg, b_arg, mpz_mod, NULL, 1, 1 TSRMLS_CC);
 }
 /* }}} */
 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 18:01:34 2024 UTC