This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

bitwise shift operations

 
Rowan Chattaway
Ranch Hand
Posts: 75
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone quickly explain to me the behavior of bitwise shift operations.
For example:

13 >> 1 = 6
13 >> 2 = 3
13 >> 3 = 1

I understand the logic in how these bits are shifted and the end result in these cases.
I also understand why if you shift over 3 then you should get 0 back.

However, my question is this: when you bitwise shift 13 to the right by 32, why do you get 13?

13 >> 32 = 13.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try reading through this.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic