RE: Bit masking and shifts 09-01-2015, 01:22 AM
#13
(08-31-2015, 07:18 AM)0xDEAD10CC Wrote: It's also still easy to create a bit rotation macro without the ASM:
Code:#define rotr(x) ((((x) & 1) << 7) | (((x) & 0xFE) >> 1)) #define rotl(x) (((x) & 0x80) >> 7) | (((x) & 0x7F) << 1)
Yes, but that is bit rotation without carry. C exposes no access to the carry bit without use of assembly, therefore it is not possible to create a true rotate through carry or shift through carry.
It amuses me how you vanish until I make a post in the coding forum, and you have to attempt to 1-up me.


























![[+]](https://sinister.li/images/modern/collapse_collapsed.png)