[Ffmpeg-cvslog] CVS: ffmpeg/libavutil mathematics.c,1.5,1.6
Michael Niedermayer CVS
michael
Sat Apr 29 17:38:22 CEST 2006
Update of /cvsroot/ffmpeg/ffmpeg/libavutil
In directory mail:/var2/tmp/cvs-serv18538
Modified Files:
mathematics.c
Log Message:
<= vs. >= 10l bug
Index: mathematics.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavutil/mathematics.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mathematics.c 28 Apr 2006 19:45:16 -0000 1.5
+++ mathematics.c 29 Apr 2006 15:38:20 -0000 1.6
@@ -82,7 +82,7 @@
// 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 @@
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 @@
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);
}
}
}
More information about the ffmpeg-cvslog
mailing list