aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/eval.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-10-16 19:06:56 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-10-16 19:06:56 +0000
commit2c409cc7af4a593a9a96162b6faeb9e814ee3eeb (patch)
treecc89ed92caf35bf38e9603add170626466eb6b7c /libavcodec/eval.c
parentcacb17b47f18a697900cd2fd4ecb66535c52c873 (diff)
downloadffmpeg-2c409cc7af4a593a9a96162b6faeb9e814ee3eeb.tar.gz
fix -a^b which was interpreted as (-a)^b
Originally committed as revision 6713 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/eval.c')
-rw-r--r--libavcodec/eval.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libavcodec/eval.c b/libavcodec/eval.c
index 9bc0c4b725..a676b95ca7 100644
--- a/libavcodec/eval.c
+++ b/libavcodec/eval.c
@@ -209,19 +209,22 @@ static double evalPrimary(Parser *p){
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){