This week's giveaway is in the Java/Jakarta EE forum.
We're giving away four copies of Java EE 8 High Performance and have Romain Manni-Bucau on-line!
01111111 11111111 11111111 11111111

add one:
10000000 00000000 00000000 00000000

Read this like a regular binary number (2147483648), but remember that it was negative. That's why 0x80000000 is -2147483648 in decimal.

> After shift x equals 0

When you shift the bits left, it fills with zeros. High bits drop off the left side, never to return. So, when you shift this left by one...
10000000 00000000 00000000 00000000 get...
00000000 00000000 00000000 00000000

The high order bit dives into the bit bucket, and we're left with zero.

Hope this helps.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!