[gimp] Bug 738951 - (modulo n m) may fail for m >= 46342 (in 32-bit) or m >= 3037000501 (in 64-bit)



commit f665e4cfa91facf38970d93f9e8e835e6ea1734d
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 06137db..86b02fe 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -498,7 +498,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);
@@ -520,7 +520,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]