[gimp] Fixed modulo function which affected 'random' procedure. (See bug #647541)
- From: Kevin Cozens <kcozens src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Fixed modulo function which affected 'random' procedure. (See bug #647541)
- Date: Wed, 13 Apr 2011 18:52:13 +0000 (UTC)
commit f1c20cb165d2db8702a9f6ba61d32b590ae88979
Author: Kevin Cozens <kcozens cvs gnome org>
Date: Wed Apr 13 13:38:04 2011 -0400
Fixed modulo function which affected 'random' procedure. (See bug #647541)
plug-ins/script-fu/tinyscheme/scheme.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index 6571405..d9aa2cd 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -516,12 +516,14 @@ static num num_mod(num a, num b) {
e1=num_ivalue(a);
e2=num_ivalue(b);
res=e1%e2;
- if(res*e2<0) { /* modulo should have same sign as second operand */
- e2=labs(e2);
- if(res>0) {
- res-=e2;
- } else {
- res+=e2;
+ /* modulo should have same sign as second operand */
+ if (res > 0) {
+ if (e2 < 0) {
+ res*=-1L;
+ }
+ } else {
+ if (e2 > 0) {
+ res*=-1L;
}
}
ret.value.ivalue=res;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]