Q:

bitwise rotate operation for arduino

I'm programming an arduino for led matrix project with shift registers i have  to rotate  output value (which is a byte) but when i use "<<" operator it does not rotate the value properly ,simply it adds zero to LSB .
byte ilk=0b01100001;
int latch=10;
int clock=8;
int data=9;
void setup(){
pinMode(latch,OUTPUT);
pinMode(data,OUTPUT);
pinMode(clock,OUTPUT);
}

void loop(){
  digitalWrite(latch,LOW);
  shiftOut(data,clock,MSBFIRST,ilk);
  digitalWrite(latch,HIGH);
  ilk=ilk<<1;
  delay(200);
}

How can i do this right way ?Is there any operator like ROL.

A:

Because << is not the "rotate left" operator. It's the arithmetic left shift operator. You can use something like
uint32_t rotl(uint32_t n, uint32_n b)
{
    return (n << b) | (n >> (32 - b));
}

instead. Write sizeof(n) * CHAR_BIT - b in the right-hand side of the bitwise OR operator if you want this to be independent of the size of the integral type you use.

