This fixes a whole sea of -Wshift-negative-value reported with clang 3.7+, e.g http://fate.ffmpeg.org/log.cgi?time=20150918181527&log=compile&slot=x86_64-darwin-clang-polly-vectorize-stripmine-3.7. Any half decent compiler should anyway optimize away the multiplication.
Signed-off-by: Ganesh Ajjanagadde <gajjanaga...@gmail.com> --- libavcodec/indeo3data.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/indeo3data.h b/libavcodec/indeo3data.h index e7e28a3..7a2df12 100644 --- a/libavcodec/indeo3data.h +++ b/libavcodec/indeo3data.h @@ -237,10 +237,11 @@ * Pack two delta values (a,b) into one 16bit word * according with endianness of the host machine. */ +#define POW_2(n) (1 << (n)) #if HAVE_BIGENDIAN -#define PD(a,b) (((a) << 8) + (b)) +#define PD(a,b) (((a) * POW_2(8)) + (b)) #else -#define PD(a,b) (((b) << 8) + (a)) +#define PD(a,b) (((b) * POW_2(8)) + (a)) #endif /** @@ -285,9 +286,9 @@ static const int16_t delta_tab_3_5[79] = { TAB_3_5 }; * according with endianness of the host machine. */ #if HAVE_BIGENDIAN -#define PD(a,b) (((a) << 24) + ((a) << 16) + ((b) << 8) + (b)) +#define PD(a,b) (((a) * POW_2(24)) + ((a) * POW_2(16)) + ((b) * POW_2(8)) + (b)) #else -#define PD(a,b) (((b) << 24) + ((b) << 16) + ((a) << 8) + (a)) +#define PD(a,b) (((b) * POW_2(24)) + ((b) * POW_2(16)) + ((a) * POW_2(8)) + (a)) #endif /* -- 2.5.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel