summaryrefslogtreecommitdiff
path: root/libavutil/rational.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2006-11-30 11:43:08 +0000
committerMichael Niedermayer <michaelni@gmx.at>2006-11-30 11:43:08 +0000
commit62b9fc1571b1354cf596a280b5fe55a9593a7a2f (patch)
tree0b031cb4c8160fc87bdfd548dc94776f7c4d89c3 /libavutil/rational.c
parent3db1b8b5386d7d9c79008df4a64c4d871f575c3c (diff)
fix overflow and remove wrong comment
Originally committed as revision 7187 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/rational.c')
-rw-r--r--libavutil/rational.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/libavutil/rational.c b/libavutil/rational.c
index 9fcf621f0b..0e018c41b6 100644
--- a/libavutil/rational.c
+++ b/libavutil/rational.c
@@ -46,7 +46,7 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max)
}
while(den){
- int64_t x = nom / den;
+ uint64_t x = nom / den;
int64_t next_den= nom - den*x;
int64_t a2n= x*a1.num + a0.num;
int64_t a2d= x*a1.den + a0.den;
@@ -55,7 +55,6 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max)
if(a1.num) x= (max - a0.num) / a1.num;
if(a1.den) x= FFMIN(x, (max - a0.den) / a1.den);
- // Won't overflow, sum == original denominator
if (den*(2*x*a1.den + a0.den) > nom*a1.den)
a1 = (AVRational){x*a1.num + a0.num, x*a1.den + a0.den};
break;