_rotl
raw OCR
Bit-rotates an unsigned integer value to the left.
Defined in header <stdlib.h>
Syntax
#include <stdlib.h>
unsigned _rotl(unsigned value, int count);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
_rotl rotates the given value to the left count bits. The value rotated is an unsigned integer.
Return value
_rotl returns the value of value left-rotated count bits.
See also
Example
#include <stdlib.h>
#include <stdio.h>
/* rotl example */
int rotl_example(void)
{
unsigned value, result;
value = 32757;
result = _rotl (value, 1);
printfC'The value %u rotated left"
" one bit is: %u\n", value, result);
return 0;
/* rotr example */
int rotr_example(void)
{
unsigned value, result;
value = 32767;
result = _rotr(value, 1);
printfC'The value %u rotated right"
" one bit is: %u\n", value, result);
return 0;
int main(void)
{
rotl_example();
rotr_example{);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `roti` read as `_rotl`
Stable link: /3.1/stdlib.h/_rotl/
· short form /3.1/_rotl/