BITLSHIFT (Number, ShiftAmount) BITLSHIFT (Number; ShiftAmount)

Number

Number Number

The number to be shifted left.

ShiftAmount

Number Number

The number of bits to shift the number. A negative shift amount shifts the number right instead.

Returns

Number Number

The shifted number.

Shifts a number left by the specified number of bits. Shifting a number left by one bit multiplies it by two, so shifting it left by three bits multiplies it by eight.

The number and the result must be non-negative integers less than 2 raised to the power of 48. Other numbers result in an error.

Examples

DEC2BIN ( BITLSHIFT ( BIN2DEC ("00010011"), 2), 8)
DEC2BIN ( BITLSHIFT ( BIN2DEC ("00010011"); 2); 8)

Returns "01001100".

BITLSHIFT (19, 2)
BITLSHIFT (19; 2)

Returns 76. This example is equivalent to the preceding example, but does not convert the decimal numbers to binary to ease readability.

BITLSHIFT (19, - 2)
BITLSHIFT (19; - 2)

Returns 4, the same result as BITRSHIFT (19, 2) BITRSHIFT (19; 2).

fxEngine Shell Want this in your own terminal? A standalone version is coming. Get notified.
Loading fxEngine Shell