Fix av_cmp_q() with negative denominators.
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 1 Oct 2010 12:00:29 +0000 (12:00 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 1 Oct 2010 12:00:29 +0000 (12:00 +0000)
Originally committed as revision 25283 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/rational.h

index 2dd0c2c..7c6605c 100644 (file)
@@ -48,7 +48,7 @@ typedef struct AVRational{
 static inline int av_cmp_q(AVRational a, AVRational b){
     const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
 
-    if(tmp) return (tmp>>63)|1;
+    if(tmp) return ((tmp ^ a.den ^ b.den)>>63)|1;
     else    return 0;
 }