Performs a bitwise shift left operation on an integer. The first parameter is the value to shift, the second is the number of bit positions.
Examples
Produces 2 (0001 → 0010).
Produces 12 (0011 → 1100).
REM Multiply by powers of two using SHL
n = 7
PRINT SHL(n, 3) ' Same as 7 * 8 = 56
Notes
- Operates on 64-bit integers.
- Shifting left by n positions is equivalent to multiplying by 2^n.
- Bits shifted out on the left are discarded; new bits on the right are filled with zero.
- If the shift count is negative or larger than the bit width, behaviour is undefined.
See also: SHR · BITAND · BITOR · BITNAND