From 0c6097f117f0801f5de513787e3bbf95545502bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Fri, 22 Sep 2000 14:25:59 +0200 Subject: [PATCH] `*(a, b, c) now evaluates to `*(`*(a, b), c) and not `*(a, `*(b, c)). Rev: src/operators.c:1.102 --- src/operators.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/operators.c b/src/operators.c index e93350b3ce..d3747541a0 100644 --- a/src/operators.c +++ b/src/operators.c @@ -6,7 +6,7 @@ /**/ #include "global.h" #include <math.h> -RCSID("$Id: operators.c,v 1.101 2000/08/31 14:43:00 grubba Exp $"); +RCSID("$Id: operators.c,v 1.102 2000/09/22 12:25:59 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "multiset.h" @@ -1698,7 +1698,18 @@ PMOD_EXPORT void f_multiply(INT32 args) { CALL_OPERATOR(LFUN_MULTIPLY, args); } else { - while(--args > 0) o_multiply(); + INT32 i = -args, j = -1; + /* Reverse the arguments */ + while(i < j) { + struct svalue tmp = sp[i]; + sp[i++] = sp[j]; + sp[j--] = tmp; + } + while(--args > 0) { + /* Restore the order, and multiply */ + stack_swap(); + o_multiply(); + } } } } -- GitLab