[x265] Negative integer shifts
Andrey Semashev
andrey.semashev at gmail.com
Wed Apr 26 16:54:38 CEST 2017
Hi,
While compiling 2.4 I'm seeind lots of warnings like this:
.../source/common/ipfilter.cpp: In instantiation of ‘void
{anonymous}::interp_horiz_ps_c(const pixel*, intptr_t, int16_t*,
intptr_t, int, int) [with int N = 8; int width = 4; int height = 4;
pixel = unsigned char; intptr_t = long int; int16_t = short int]’:
.../source/common/ipfilter.cpp:417:5: required from here
.../source/common/ipfilter.cpp:126:36: warning: left shift of negative
value [-Wshift-negative-value]
int offset = -IF_INTERNAL_OFFS << shift;
~~~~~~~~~~~~~~~~~~^~~~~~~~
Left-shifting negative signed intehers is undefined behavior in C++.
I've attached a patch that resolves the warnings. The patch assumes 2's
complement signed integers and that the shift does not introduce an
arithmetic overflow.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_negative_shifts.patch
Type: text/x-patch
Size: 1083 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20170426/be60dddf/attachment.bin>
More information about the x265-devel
mailing list