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

Jason Garrett-Glaser darkshikari at gmail.com
Fri Dec 12 20:42:20 CET 2008


On Fri, Dec 12, 2008 at 10:13 AM, Leon Woestenberg
<leon.woestenberg at gmail.com> 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.

Since when is it incorrect to shift a 64-bit value by 32 bits?

Dark Shikari


More information about the x264-devel mailing list