[FFmpeg-cvslog] avcodec/indeo3data: fix undefined left shift of negative number

Ganesh Ajjanagadde git at videolan.org
Sat Sep 19 07:44:45 CEST 2015


ffmpeg | branch: master | Ganesh Ajjanagadde <gajjanagadde at gmail.com> | Sat Sep 19 02:43:39 2015 -0300| [8c9853a69ba828f814d01539bddddd0950cf1863] | committer: James Almer

avcodec/indeo3data: fix undefined left shift of negative number

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 <gajjanagadde at gmail.com>
Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8c9853a69ba828f814d01539bddddd0950cf1863
---

 libavcodec/indeo3data.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/indeo3data.h b/libavcodec/indeo3data.h
index e7e28a3..fe8f0ba 100644
--- a/libavcodec/indeo3data.h
+++ b/libavcodec/indeo3data.h
@@ -238,9 +238,9 @@
  * according with endianness of the host machine.
  */
 #if HAVE_BIGENDIAN
-#define PD(a,b) (((a) << 8) + (b))
+#define PD(a,b) (((a) * (1 << 8)) + (b))
 #else
-#define PD(a,b) (((b) << 8) + (a))
+#define PD(a,b) (((b) * (1 << 8)) + (a))
 #endif
 
 /**
@@ -285,9 +285,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) * (1 << 24)) + ((a) * (1 << 16)) + ((b) * (1 << 8)) + (b))
 #else
-#define PD(a,b) (((b) << 24) + ((b) << 16) + ((a) << 8) + (a))
+#define PD(a,b) (((b) * (1 << 24)) + ((b) * (1 << 16)) + ((a) * (1 << 8)) + (a))
 #endif
 
 /*



More information about the ffmpeg-cvslog mailing list