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

Leon Woestenberg leon.woestenberg at gmail.com
Sat Dec 13 13:16:53 CET 2008


Hello Loren, Jason,

On Fri, Dec 12, 2008 at 7:51 PM, Loren Merritt <lorenm at u.washington.edu> wrote:
> 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);
>>
> The code is correct and portable.
> Blame gcc for not suppressing the warning when it's under if(0).
>
Indeed, sorry for the noise. I wrongly assumed the warning was correct
and didn't look beyond.

Changing the code would merely work around that GCC warning issue. Not
desirable.

        return endian_fix32((x>>16)>>16) +
(((uint64_t)endian_fix32(x)<<16)<<16);

Regards,
-- 
Leon


More information about the x264-devel mailing list