On Nov 4, 2005, at 1:26, Luke Palmer wrote:

On 11/3/05, Leopold Toetsch <[EMAIL PROTECTED]> wrote:

Shifting anything by >= the bits of the int isn't portable nor
specified.

Why isn't it specified?  It seems to me that it should be zero.

C standard (actually from a draft of C99)

If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined.

amd3-24594.pdf (AMD x86-64 Architecture Programmer’s Manual)

The processor masks the upper three bits of the count operand, thus restricting the count to a number between 0 and 31. When the destination is 64 bits wide, the processor masks the upper two bits of the count, providing a count in the range of 0 to 63.

Luke

leo

Reply via email to