<-- Previous || Up || Next -->

Shift Left Function
Bitwise Class

Public Function ShiftLeft( _
      ByVal vValue As Variant _
    , ByVal vNBits As Variant _
    ) As Variant

Shift the bits to the left within any type of value, losing those bits in the most-significant-positions and filling the least-significant-bits with 0 (zero).

Examples:
    ShiftLeft( 3, 2) = 12
    ShiftLeft(-3, 2) = -12
    ShiftLeft(32767, 2) = -4
    ShiftLeft(Chr$(16) + Chr$(32), 2) = Chr$(64) + Chr$(128)
In the Shift Left operation, the bits of the string are shifted to the left (less-significant-bits are shifted to more-significant-positions). Those bits which were occupying the vNBits most-significant-positions are lost, and the vNBits least-significant-bits are set to 0 (zero).
See also:
    RotateLeft Function
    ShiftRight Function
vValue: Value whose bits are to be shifted left. Function returns Null if vValue is Null.

vNBits: The number of positions that the bits within vValue are to be shifted left. Function returns Null if vNBits is Null or cannot be fixed up to a number.

Function returns vValue unchanged if vNBits is 0 (zero).

If vNBits is < 0 (less than zero), then the function will shift bits to the right instead of to the left.

Function will return the same type of value as vValue, or in the case of Date values (in which not all combinations of bits are valid) it may possibly generate a runtime error.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.