Circular Shift

Is it possible to do a circular shift in C?

[Edit]

I mean a bitwise circular shift.

Currently 1 >> 1 evaluates to zero.

[Edit-2: removed the mistake]
Last edited on
You could use inline assembler (instructions rol, ror, I believe) or write one yourself using >> and <<.
By the way, your edit is wrong. I'll show in 8 bits. if you roll 00000001 right, you get 10000000 which is 27 = unsigned 128 = signed -128. Largest integer unsigned number is 255 = 11111111 = not 0 = signed -1.
Topic archived. No new replies allowed.