Patch C99_ZEND_patch_euclidean_modulo for Documentation problem Bug #53208
Patch version 2010-10-30 17:46 UTC
Return to Bug #53208 |
Download this patch
Patch Revisions:
Developer: fibrefox@dynamicfiles.de
--- C:/Users/FibreFoX/Desktop/php-5.2.14/Zend/zend_operators.c Sat Jun 19 22:47:24 2010
+++ C:/Users/FibreFoX/Desktop/zend_operators.c Sat Oct 30 19:39:15 2010
@@ -970,7 +970,9 @@
}
result->type = IS_LONG;
- result->value.lval = op1->value.lval % op2->value.lval;
+
+ // c++ modulo is no true modulo, so here the true modulo-version (optimized)
+ result->value.lval = (op1->value.lval < 0 ? ((op1->value.lval % op2->value.lval) + op2->value.lval) % op2->value.lval : op1->value.lval % op2->value.lval);
return SUCCESS;
}
|