SHRD : A Ruby Interpretation of the Double Precision Shift Right Assembly Instruction
Following on from my last post on Assembly conversion, I also came across the SHRD instruction.
I already knew about the SHR & SHL command, logical shift right & left respectively, which translates rather easily:
Assembly | Ruby | ||||
---|---|---|---|---|---|
|
|
||||
|
|
But I was initially stumped when I saw
1
|
|
in the Assembly code listing.
I’d figured out I needed the following test data, from the debugger
1 2 3 |
|
And then this link gave me the insight I needed to code it up.
Voila:
1 2 3 4 5 6 |
|
The test went from red to green :)
“They will not control us. We will be victourious!!!!!!”
:D