1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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

Originally committed as revision 6713 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2006-10-16 19:06:56 +00:00
parent cacb17b47f
commit 2c409cc7af

View File

@ -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){