[Ffmpeg-cvslog] r6713 - trunk/libavcodec/eval.c

michael subversion
Mon Oct 16 21:06:59 CEST 2006


Author: michael
Date: Mon Oct 16 21:06:56 2006
New Revision: 6713

Modified:
   trunk/libavcodec/eval.c

Log:
fix -a^b which was interpreted as (-a)^b


Modified: trunk/libavcodec/eval.c
==============================================================================
--- trunk/libavcodec/eval.c	(original)
+++ trunk/libavcodec/eval.c	Mon Oct 16 21:06:56 2006
@@ -209,19 +209,22 @@
     return d;
 }
 
-static double evalPow(Parser *p){
-    int sign= (*p->s == '+') - (*p->s == '-');
-    p->s += sign&1;
-    return (sign|1) * evalPrimary(p);
+static double evalPow(Parser *p, int *sign){
+    *sign= (*p->s == '+') - (*p->s == '-');
+    p->s += *sign&1;
+    return evalPrimary(p);
 }
 
 static double evalFactor(Parser *p){
-    double ret= evalPow(p);
+    int sign, sign2;
+    double ret, e;
+    ret= evalPow(p, &sign);
     while(p->s[0]=='^'){
         p->s++;
-        ret= pow(ret, evalPow(p));
+        e= evalPow(p, &sign2);
+        ret= pow(ret, (sign2|1) * e);
     }
-    return ret;
+    return (sign|1) * ret;
 }
 
 static double evalTerm(Parser *p){




More information about the ffmpeg-cvslog mailing list