Revision d01dbeb8 libavcodec/utils.c

View differences:

libavcodec/utils.c
776 776

  
777 777
    assert(den != 0);
778 778

  
779
    if(den < 0){
780
        den= -den;
781
        nom= -nom;
782
    }
779
    if(den < 0)
780
        return av_reduce(dst_nom, dst_den, -nom, -den, max);
783 781
    
784
    if(nom < 0){
785
        nom= -nom;
786
        sign= 1;
787
    }
782
    sign= nom < 0;
783
    nom= ABS(nom);
788 784
    
789 785
    gcd = ff_gcd(nom, den);
790 786
    nom /= gcd;
......
814 810
    
815 811
    assert(ff_gcd(nom, den) == 1);
816 812
    
817
    if(sign) nom= -nom;
818
    
819
    *dst_nom = nom;
813
    *dst_nom = sign ? -nom : nom;
820 814
    *dst_den = den;
821 815
    
822 816
    return exact;

Also available in: Unified diff