[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 NUMROL()
 Performs a 16-bit left rotation of a number
------------------------------------------------------------------------------
 Syntax

     NUMROL(<nWORD1|cHexWORD1>,<nWORD2|cHexWORD2>,
        [<lLowByte>]) --> nWORDLeft-Rotated

 Arguments

     <nWORD1|cHexWORD1>  Designates a numeric or hexadecimal value in the
     range of 0 to 65535.

     <nWORD2|cHexWORD2>  Designates a number of rotations in the range of
     1 to 15 (1 to 7); as either numeric or hexadecimal.

     <lLowByte>  If this optional parameter is designated as .T., then
     the low byte of the specified WORD is rotated.  The default is a 16-bit
     rotation (.F.).

 Returns

     NUMROL() returns the rotation result.

 Description

     This function rotates bits to the left in a number between 0 and 65535
     (16-bit value).  When the high bit rotates it is not just moved out to
     the left, it is also moved in on the right.  Use the optional logical
     parameter to determine if all 16 or only the low value 8 bits are to
     rotate.

 Notes

     .  If a value of > 15(7) is designated for <nWORD1|cHexWORD1>,
        the actual number of rotations for the remainder corresponds to a
        value divided by 16(8).

     .  A right rotation is also possible.  One rotation to the right
        corresponds to 15(or 7) rotations to the left, etc..

 Examples

     .  Rotate the 1 value three times to the left:

        00000000 00000001  00000000 00001000
        ? NTOC(1, 2, 16, "0"), NTOC(NUMROL(1, 3), 2, 16, "0")
                                         // Display as binary

     .  Value of 60000 -- only rotate the low 8-bit value:

        11101010 01100000  11101010 10000001
        NUMROL(60000, 2, .T.)

     .  Construct a rotation two places to the right:

        00000000 00000100  00000000 00000001
        ? NUMROL(4, 14)

     .  In parameter 2 > 15, there is only one rotation:

        ? NUMROL(1, 33)                  // Result:  2


See Also: NTOC()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson