Mail Archives: djgpp/2003/01/22/20:30:19
Hey, you forgot SHLD/SHRD :)
No, but seriously, I don't need it. Thanks for the code that you
already provided.
> There are also RCL and RCR, which would need the Rotate
> and Shift operations
> I gave to also have a carry flag. RCL and RCR are useful
> when you want to
> rotate values of more than 32 bits by 1 bit at a time.
> Otherwise, I don't
> know why Intel allowed RCL and RCR to have shift amounts
> of more than 1 bit.
> Maybe they just wanted to give RCL/RCR equal footing to the other
> shift/rotate operations.
>
> unsigned long rcl (unsigned long src, unsigned long samt,
> int *carry){
> unsigned long dst;
> samt &= 31;
> if (samt == 0){
> dst = src;
> } else {
> dst = (src << samt) | (src >> (33 - samt)) |
> (carry ? (1 << (samt -
> 1)) : 0);
> carry = src & (1 << (32 - samt));
> }
> return dst;
> }
>
> unsigned long rcr (unsigned long src, unsigned long samt,
> int *carry){
> unsigned long dst;
> samt &= 31;
> if (samt == 0){
> dst = src;
> } else {
> dst = (src >> samt) | (src << (33 - samt)) |
> (carry ? (1 << (32 -
> samt)) : 0);
> carry = src & (1 << (samt - 1));
> }
> return dst;
> }
--
Posted via http://web2news.com the faster web2news on the web
- Raw text -