aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-04-30 18:11:34 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-04-30 18:11:34 +0000
commitd01dbeb800b382658683ad154127438473e19b14 (patch)
treeaeecd370d81516d07577ca18b6c8ed472e0805ef
parent1545aceaaf3a817117c650233c676b9f252342ab (diff)
downloadffmpeg-d01dbeb800b382658683ad154127438473e19b14.tar.gz
simplify
Originally committed as revision 3097 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/utils.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 59e9a3058f..6998f77223 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -776,15 +776,11 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max)
assert(den != 0);
- if(den < 0){
- den= -den;
- nom= -nom;
- }
+ if(den < 0)
+ return av_reduce(dst_nom, dst_den, -nom, -den, max);
- if(nom < 0){
- nom= -nom;
- sign= 1;
- }
+ sign= nom < 0;
+ nom= ABS(nom);
gcd = ff_gcd(nom, den);
nom /= gcd;
@@ -814,9 +810,7 @@ int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max)
assert(ff_gcd(nom, den) == 1);
- if(sign) nom= -nom;
-
- *dst_nom = nom;
+ *dst_nom = sign ? -nom : nom;
*dst_den = den;
return exact;