9

I want to convert this to C:

SHR CL,1

rECX is the name of the (32bit unsigned int)register variable. It should be simple, but I can't figure out the proper pointer magic :/

2
  • *(unsigned char*)&rECX >>= 1; I knew it was easy :)
    – user3590
    Jan 8, 2014 at 19:42
  • 1
    Folks, please don't forget to vote up questions, too! Although this would likely be more fitting for SO, it's a valid question that internauts may find useful. Voting will help it pop up more prominently and reward the asker.
    – 0xC0000022L
    Jan 9, 2014 at 2:12

1 Answer 1

13

rECX = (rECX & 0xFFFFFF00) | ((rECX & 0xFF) >> 1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.