Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_rotl() shift an int to the left</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _rotl()                 Shift an Int to the Left

 #include   <stdlib.h>

  unsigned int _rotl(value, shift);
  unsigned int value;    Value to be rotated
  int shift;             Number of bits to shift

    _rotl() rotates value to the left by shift bits.

    Returns:    _rotl() returns the rotated value. There is no error
                return.

      Notes:    Bits shifted off the left re-enter on the right, unlike
                the C shift operator (<<) which fills the vacated bits
                with 0's.

   Portability:     MS-DOS only

 -------------------------------- Example ---------------------------------

 This program shifts the hex value 0x1234 four bits (one hex digit) to
 the left and prints the output ( 0x2341 )

           #include <stdlib.h>

           main()
           {
              unsigned int value = 0x1234;
              printf("_rotl(%X, 4) = 0x%4.4X\n", value, _rotl(value, 4));
           }


See Also: _rotr() _lrotr() _lrotl()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson