diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-04-29 15:38:20 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-04-29 15:38:20 +0000 |
commit | 5c1cb3792d063a1e3b974ed86591cfce2eca2c76 (patch) | |
tree | 52a484ee195bf3617319873e516e79220f6057f5 | |
parent | 2848ce84d29259689547944e35b92ad3ac8b4dab (diff) | |
download | ffmpeg-5c1cb3792d063a1e3b974ed86591cfce2eca2c76.tar.gz |
<= vs. >= 10l bug
Originally committed as revision 5333 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavutil/mathematics.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c index dabf50b72f..b2e480fca1 100644 --- a/libavutil/mathematics.c +++ b/libavutil/mathematics.c @@ -82,7 +82,7 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){ // int o= a1 & 0x8000000000000000ULL; a1+= a1 + ((a0>>i)&1); t1+=t1; - if(/*o || */c >= a1){ + if(/*o || */c <= a1){ a1 -= c; t1++; } @@ -109,12 +109,13 @@ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); } #if 0 +#undef printf main(){ int64_t a,b,c,d,e; - for(a=7; a<256*256*256*128LL; a=(a*3)+1){ - for(b=3; b<256*256*256*128LL; b=(b*5)/4+1){ - for(c=9; c<256*256*256*128LL; c=(c*7)/5+3 ){ + for(a=7; a<256LL*256*256*256*128; a=(a*3)+1){ + for(b=3; b<256LL*256*256*256*128; b=(b*5)/4+1){ + for(c=9; c<256LL*256*256*256*128; c=(c*7)/5+3 ){ int64_t r= c/2; AVInteger ai; ai= av_mul_i(av_int2i(a), av_int2i(b)); @@ -124,7 +125,10 @@ main(){ e= av_rescale(a,b,c); - if(d!=e) printf("%Ld*%Ld/%Ld= %Ld=%Ld\n"L, a, b, c, d, e); + if((double)a * (double)b / (double)c > (1LL<<63)) + continue; + + if(d!=e) printf("%Ld*%Ld/%Ld= %Ld=%Ld\n", a, b, c, d, e); } } } |