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 */will generate the following code:
...
i = ((i « 1) | (i » 7));
...
mov a,_iSDCC uses pattern matching on the parse tree to determine this operation.Variations of this case will also be recognized as bit-rotation, i.e.:
rl a
mov _i,a
i = ((i » 7) | (i « 1)); /* left-bit rotation */