changeset 1996:f481d3309ad0 libavcodec

simplify
author michael
date Fri, 30 Apr 2004 18:11:34 +0000
parents 38e77ac19836
children 7bd3932bc918
files utils.c
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Fri Apr 30 18:09:24 2004 +0000
+++ b/utils.c	Fri Apr 30 18:11:34 2004 +0000
@@ -776,15 +776,11 @@
 
     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 @@
     
     assert(ff_gcd(nom, den) == 1);
     
-    if(sign) nom= -nom;
-    
-    *dst_nom = nom;
+    *dst_nom = sign ? -nom : nom;
     *dst_den = den;
     
     return exact;