8.1.9 Bit-rotation
Keywords: sdccman

##
8.1.9 Bit-rotation

A special case of the bit-shift operation is bit rotation, SDCC recognizes the following expression to be a left bit-rotation:

> unsigned char i; /* unsigned is needed for rotation */
> ...
> i = ((i « 1) | (i » 7));
> ...

will generate the following code:

> mov a,_i
> rl a
> mov _i,a

SDCC uses pattern matching on the parse tree to determine this operation.Variations of this case will also be recognized as bit-rotation, i.e.:

> i = ((i » 7) | (i « 1)); /* left-bit rotation */