4.5.2 Rotation

The C language does not specify a rotate operator; however, it does allow shifts. You can follow the C code examples below to perform rotations for 16-bit integers.

unsigned char c;
unsigned int u;
c = (c << 1) | (c >> 7); // rotate left, one bit
u = (u >> 2) | (u << 14); // rotate right, two bits