[gimp/gimp-2-8] Bug 738951 - (modulo n m) may fail for m >= 46342 (in 32-bit) or m >= 3037000501 (in 64-bit)
- From: Michael Schumacher <schumaml src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 738951 - (modulo n m) may fail for m >= 46342 (in 32-bit) or m >= 3037000501 (in 64-bit)
- Date: Sun, 29 May 2016 12:43:51 +0000 (UTC)
commit 6d454fdc85699983489265018433a56dd1130e1d
Author: Pedro Gimeno <bugzilla gnome personal formauri es>
Date: Sun May 29 00:13:22 2016 +0200
Bug 738951 - (modulo n m) may fail for m >= 46342 (in 32-bit) or m >= 3037000501 (in 64-bit)
plug-ins/script-fu/tinyscheme/scheme.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index 5ef5c5c..23caa63 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -497,7 +497,7 @@ static num num_rem(num a, num b) {
e1=num_ivalue(a);
e2=num_ivalue(b);
res=e1%e2;
- /* remainder should have same sign as second operand */
+ /* remainder should have same sign as first operand */
if (res > 0) {
if (e1 < 0) {
res -= labs(e2);
@@ -519,7 +519,7 @@ static num num_mod(num a, num b) {
e2=num_ivalue(b);
res=e1%e2;
/* modulo should have same sign as second operand */
- if (res * e2 < 0) {
+ if ((res < 0) != (e2 < 0) && res) { /* if their sign is different... */
res+=e2;
}
ret.value.ivalue=res;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]