[x265] Negative integer shifts

Mario *LigH* Rohkrämer contact at ligh.de
Thu Apr 27 08:16:58 CEST 2017


Hi.

Ma0 already submitted a patch on April 20th, which handles this issue by  
casting them to unsigned. I guess it was not yet committed.

By the way, Multicoreware prefers patches in plain text in the message  
body for easier review.


Am 26.04.2017, 16:54 Uhr, schrieb Andrey Semashev  
<andrey.semashev at gmail.com>:

> 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.


-- 

Fun and success!
Mario *LigH* Rohkrämer
mailto:contact at ligh.de
 


More information about the x265-devel mailing list