diff options
author | Alfred E. Heggestad <aeh@db.org> | 2013-08-26 22:31:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-08-27 14:25:34 +0200 |
commit | 16c3ed5837884e2b60cf40e762be6c58b13d7ba6 (patch) | |
tree | 22d2859807935461e1e95f1679376e29e5bcc92c | |
parent | 231201382ea0697b9e29fabcd7996db719ea8b9a (diff) | |
download | ffmpeg-16c3ed5837884e2b60cf40e762be6c58b13d7ba6.tar.gz |
libavutil: cast truncated values to uint32_t
programs using ffmpeg that are compiled with -Wshorten-64-to-32
gives a warning when using header files common.h and rational.h
cast 64-bit truncated values to (uint32_t) to avoid the warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavutil/common.h | 4 | ||||
-rw-r--r-- | libavutil/rational.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/libavutil/common.h b/libavutil/common.h index c7c32fd363..9f0f998682 100644 --- a/libavutil/common.h +++ b/libavutil/common.h @@ -175,7 +175,7 @@ static av_always_inline av_const int16_t av_clip_int16_c(int a) */ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) { - if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF); else return (int32_t)a; } @@ -279,7 +279,7 @@ static av_always_inline av_const int av_popcount_c(uint32_t x) */ static av_always_inline av_const int av_popcount64_c(uint64_t x) { - return av_popcount((uint32_t)x) + av_popcount(x >> 32); + return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32)); } #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) diff --git a/libavutil/rational.h b/libavutil/rational.h index 417e29e577..b9800ee360 100644 --- a/libavutil/rational.h +++ b/libavutil/rational.h @@ -55,7 +55,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 ^ a.den ^ b.den)>>63)|1; + if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1; 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; |