rotate an unsigned integer to the right
#include <stdlib.h>
unsigned int _rotr( unsigned int value,
unsigned int shift );
The _rotr() function rotates the unsigned integer, value, to the right by the number of bits specified in shift. If you port an application using _rotr() between a 16-bit and a 32-bit environment, you'll get different results because of the difference in the size of integers.
The rotated value.
#include <stdio.h>
#include <stdlib.h>
unsigned int mask = 0x1230;
void main()
{
mask = _rotr( mask, 4 );
printf( "%04X\n", mask );
}
produces the output:
0123
WATCOM
| Safety: | |
|---|---|
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |