### _crotl - _crotr -- Rotate Bits of Character Value

Format

>     #include <stdlib.h>    /* also in <builtin.h> */
>     unsigned char _crotl(unsigned char value, int shift);
>     unsigned char _crotr(unsigned char value, int shift);

Language Level: Extension
The _crotl and _crotr functions rotate the character value by shift bits. The _crotl function rotates to the left, and _crotr to the right.

Note: Both _crotl and _crotr are built-in functions, which means they are implemented as inline instructions and have no backing code in the library. For this reason:

- You cannot take the address of these functions.
- You cannot parenthesize a call to either function. (Parentheses specify a call to the function's backing code, and these functions have none.)

Return Value
Both functions return the rotated value. There is no error return value.

Example
This example uses _crotl and _crotr with different shift values to rotate the character value:

    #include <stdio.h>
    #include <stdlib.h>

    int main(void)
    {
       unsigned char val = 0X01;

       printf("The value of 0x%2.2x rotated 4 bits to the left is 0x%2.2x\n", val,
          _crotl(val, 4));
       printf("The value of 0x%2.2x rotated 2 bits to the right is 0x%2.2x\n",
          val, _crotr(val, 2));
       return 0;

       /****************************************************************************
          The output should be:

          The value of 0x01 rotated 4 bits to the left is 0x10
          The value of 0x01 rotated 2 bits to the right is 0x40
       ****************************************************************************/
    }

_lrotl - _lrotr -- Rotate Bits of Unsigned Long Value
_rotl - _rotr -- Rotate Bits of Unsigned Integer
_srotl - _srotr -- Rotate Bits of Unsigned Short Value
<stdlib.h>
<builtin.h>