Re: Shifting: what's going on?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Facundo,

> I expect to get a 1 in the s-th bit of a, and zeroes in all other
> bits. I don't know why you say that's an arithmetic overflow, if
> unsigned long long is 64 bits long and it has a 63-th bit (the last
> one).

You are not dealing with an unsigned long long that is 64-bits.

You are dealing with a signed int that is 32-bits.

Shifting a number by an amount equal-to-or-greater-than its bitsize has
undefined behavior.

--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux