xHarbour Reference Documentation > Function Reference |
Rotates bits of a numeric 16-bit integer value to the left.
NumRoL( <nInteger>|<cHex> , ; <nRotate>|<cRotate>, ; [<lEightBits>] ) --> nInteger
The function returns the result of the bit rotation as a numeric value.
See also: | <<, >>, NumRolX(), NtoC() |
Category: | CT:NumBits , Bitwise functions , Numbers and Bits |
Source: | ct\bit1.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example displays the results of left bit rotation and their // binary representation. Note that the most significant bit replaces // the least significant bit in a rotation, while all other bits are // shifted to the left. PROCEDURE Main LOCAL nValue := CtoN( "0010100001110000", 2 ) ? nValue // result: 10352 ? NtoC( nValue, 2, 16, "0" ) // result: 0010100001110000 ? NumRol( nValue, 3 ) // result: 17281 ? NtoC( NumRol( nValue, 3 ), 2, 16, "0" ) // result: 0100001110000001 ? NumRol( nValue, 3, .T. ) // result: 10371 ? NtoC( NumRol( nValue, 3, .T. ), 2, 16, "0" ) // result: 0010100010000011 RETURN
http://www.xHarbour.com