diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-10-05 01:43:31 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-10-05 01:43:31 +0000 |
commit | dec112691561bddaea07e0ad455a71bf29ade60d (patch) | |
tree | ccee1a26797919b8435d837ab057a628479d5b3d /libavutil/rational.h | |
parent | cfa5a81ea672ac355afad88ea239f7ba5c3d72f0 (diff) | |
download | ffmpeg-dec112691561bddaea07e0ad455a71bf29ade60d.tar.gz |
Make av_cmp_q() work with infinities and NAN.
Originally committed as revision 25338 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/rational.h')
-rw-r--r-- | libavutil/rational.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/rational.h b/libavutil/rational.h index 21542a8abe..15df06f4af 100644 --- a/libavutil/rational.h +++ b/libavutil/rational.h @@ -29,6 +29,7 @@ #define AVUTIL_RATIONAL_H #include <stdint.h> +#include <limits.h> #include "attributes.h" /** @@ -49,7 +50,9 @@ 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 ^ a.den ^ b.den)>>63)|1; - else return 0; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; } /** |