Le 30/04/2012 14:44, Don Clugston a écrit :

It's not a bug, it's a design flaw. The buggy behaviour is explicitly
tested in the test suite.
The problem is that the C promotion rules also apply, just as for >> and
<<. But they are fundamentally incompatible with unsigned shift.
So short and byte get promoted to int *by sign extension*,
then the int gets an unsigned shift.
Which means that the short or byte gets a signed shift instead of an
unsigned one.

Thanks for pointing that out.
Sadly, it makes some sense with the C integer promotion rules.

Reply via email to