ROL32
Result = ROL32(ValueToRotate, Bits)
 
Parameters:

    ValueToRotate=Value that will be rotated
    Bits=Number of bits the value will be rotated
Returns:

    Result
 
     ROL32 is a logical operator that rotates a 32 bit value bitwise to the left.

      Bitwise rotate simply rotates the bits in a value. For example, if you have an 8 bit value (Byte), its binary representation is %00001111. If you rotate that byte two times to the right, you get %11000011. The two bits that were in the least significant position are now in the most significant position, and all the other bits are shifted over.



FACTS:


      * ROL32, ROL16, ROL8, ROR32, ROR16 and ROR8 may alter sign of the rotated value.




Mini Tutorial:


      Showing the effect of bitwise left rotation function. Try different value, or different numbers of bits to rotate. Replace ROL32 with ROL16 or ROL8

  
; Value that will be rotated
  Value = 42
; display this value in binary form
  Print Bin$(Value)
  
; rotate value by 4 bits
  Value = ROL16(Value, 4)
  
; Display new value in binary form
  Print Bin$(Value)
  
;     rotate value by another 8 bits
  Value = ROL16(Value, 8)
  
; Display new value in binary form
  Print Bin$(Value)
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  



This example would output.

  
  %00000000000000000000000000101010
  %00000000000000000000001010100000
  %00000000000000101010000000000000
  





 
Related Info: AND | CopyBits | LSL16 | LSL32 | LSL8 | LSR16 | LSR32 | LSR8 | OR | ROL16 | ROL8 | ROR16 | ROR32 | ROR8 | XOR :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com