[gimp] Use trunc() from C99. From revision 128 of TinyScheme in SourceForge.



commit 4772f578273b002a1a82a7f75d47f52b7befda6a
Author: Kevin Cozens <kevin ve3syb ca>
Date:   Sun Sep 27 16:55:30 2020 -0400

    Use trunc() from C99. From revision 128 of TinyScheme in SourceForge.

 plug-ins/script-fu/tinyscheme/scheme.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
---
diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c
index 0cc9169009..82ce73cfeb 100644
--- a/plug-ins/script-fu/tinyscheme/scheme.c
+++ b/plug-ins/script-fu/tinyscheme/scheme.c
@@ -3409,16 +3409,9 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) {
           x=car(sc->args);
           s_return(sc, mk_real(sc, ceil(rvalue(x))));
 
-     case OP_TRUNCATE : {
-          double rvalue_of_x ;
+     case OP_TRUNCATE:
           x=car(sc->args);
-          rvalue_of_x = rvalue(x) ;
-          if (rvalue_of_x > 0) {
-            s_return(sc, mk_real(sc, floor(rvalue_of_x)));
-          } else {
-            s_return(sc, mk_real(sc, ceil(rvalue_of_x)));
-          }
-     }
+          s_return(sc, mk_real(sc, trunc(rvalue(x))));
 
      case OP_ROUND:
         x=car(sc->args);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]