[x264-devel] shift count >= width of type is not non-portable C, and even with GCC, introduces bugs

Loren Merritt lorenm at u.washington.edu
Fri Dec 12 19:51:37 CET 2008


On Fri, 12 Dec 2008, Leon Woestenberg wrote:

> ./common/osdep.h:166: warning: right shift count >= width of type
>
>        return endian_fix32(x>>32) + ((uint64_t)endian_fix32(x)<<32);
>
> A proper fix is to shift twice, 16 positions on each shift. "shift
> count >= width of type" is not non-portable C, and even with GCC,
> introduces bugs on some platforms.

The code is correct and portable.
Blame gcc for not suppressing the warning when it's under if(0).

--Loren Merritt


More information about the x264-devel mailing list