Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>rol() - bitwise rotate left of a number</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     rol() - bitwise rotate left of a number
  Usage:    rol(<int>,<number>)
  Params:   integer <int> - number to rotate, not greater then 255
            integer <number> number of rotations, less then 256
  Returns:  integer equal to the bitwise rol of <int> and <number>

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

                 ? rol(8,1)          && prints 16
                 ? rol(8,2)          && prints 32
                 ? rol(15,3)         && prints 120
                 ? rol(245,8)        && prints 245

  Note:     Rol'ing one value with another will rotate the bits
            in <int> to the left the number of times specified
            by <number>. If bit 7 is 1, that bit rotates around
            to bit position 1. this is useful when reversing the
            attributes on the screen. Rotating <int> by 8 rotates
            all bits back to where they started. rol() only works
            on integer values less than 256. eg:

                 parameter = binary       = dec
                 v1        = 00000110     = 6
                 v2        = 00000010     = 2
                 rol(v1,v2)= 00011000     = 24

            You can use num2bin() and bin2num() to convert
            binary strings into their decimal equivalents for ease
            when using the binary functions.


See Also: and() or() ror() xor() test() shl() shr()

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