Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Q.on shifting(>>>)

 
Maya Nair
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q. -42>>>4
Ans:
11111111 11111111 11111111 11010110
adding 4 zeros to right
00001111 11111111 11111111 11111101
but further how do I calculate the final value in decimal??
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The long process of this is to take each value and mulitply it by 2 to the power of the placement in the bytes.
For example: 1011:
1 x 2^3 = 8
0 x 2^2 = 0
1 x 2^1 = 2
1 x 2^0 = 1
add them up and you get 11.
This is harder for large bytes like you have, but this is the way I have always done them.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic