• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion in Shift (edit: 1.4 topic)

 
Micheal John
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
128 >>> 2
128 >> 2

-128 >>> 2
-128 >> 2

How the above four will be different? I have great confusion in understanding right shift signed and unsigned operators. Can anybody pls explain it for me?
[ November 25, 2006: Message edited by: Bert Bates ]
 
Sathishkumar Ethiraju
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
128 >>> 2
with sign
128 >> 2
without sign

abv 2 won have diff

-128 >>> 2
with sign


-128 >> 2
without sign

in the case of >>> MSB will also get shifted
0 is the msb in case of positive numbers
and 1 for negative numbers
 
Bert Bates
author
Sheriff
Posts: 8900
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
rmember ranchers - this topic is only on the 1.4 exam, it's NOT on the 5.0 exam!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic