Especially on microcontrollers or DSPs this could be quite useful. I have never seen a C-compiler able to infer a bit rotation instruction, though.
unsigned int rotv(unsigned int x, int c) {
return (x << c) | (x >> (32 - c));
}
On x86 it emits a rol instruction, for instance.Relevant to the original post here of course, as the original spec was a processor that could interpret BBC BASIC as fast as hand optimised 6502 assembler.