rotate_left

rotate a value to the left (or right)
   arguments:
        x      - value to rotate
        count  - number of times to rotate. negative counter means
                 rotate to the right
        nbits  - number of bits to rotate
        offset - offset of the first bit to rotate
returns: the value with the specified field rotated
         all other bits are not modified
Thread-safe function.

long rotate_left(long value, long count, long nbits, long offset);

#define rotate_dword(x, count) rotate_left(x, count, 32, 0)
#define rotate_word(x, count)  rotate_left(x, count, 16, 0)
#define rotate_byte(x, count)  rotate_left(x, count,  8, 0)

Last updated