View Single Post
  #2  
Old 02-15-2006, 00:22
laola
 
Posts: n/a
Smile

Quote:
Originally Posted by squareD
?? -> NEG -> ROR 6 = 45
?? -> NEG -> ROR 7 = 37
?? -> NEG -> ROR 3 = 30

In my opinion it's impossible to get out these values by using only one byte.
But may be that I'm wrong.
Why do you think it's impossible? You are probably mixing up bit shifting and bit rolling. ROL/ROR move the bit that drops out of the byte into the other end of the byte. Maybe an example helps:

0x30 -> b00110000, ROL (inversion of ROR) that three times, you get:
0x60 -> b01100000
0xC0 -> b11000000
0x81 -> b10000001

You must not try to just multiply by 2 here This is the essential difference between ROR/ROL and SHR/SHL
Reply With Quote