Home / lang / shl 
Shl
Syntax
Value = Shl ( Number , Bit AS Integer )

Returns Number shifted to the left by Bit bits.

The type of Number may be Byte, Short, Integer, or Long

The valid range of Bit depends on the type of the Number argument:

Type Range of Bit
Byte 0...7
Short 0...15
Integer 0...31
Long 0...63

Example
PRINT Shl(11, 3)

88

It may be useful to expand the type of an argument. Use for this CLong, CInt, CShort

Example
DIM b1 AS Byte
DIM i1 AS Integer
DIM i2 AS Integer

b1 = &H55
' Bad Argument, maximum = 7 for Byte for Integer : s2 = Shl(b1, 8) OR b2
i1 = Shl(CInt(b1), 16)
PRINT "i1="; Hex$(i1)
i2 = Shl(b1, 16) ' Stops here with Bad Argument
PRINT "   i2="; Hex$(i2)

i1=550000


See also
Bits Manipulation Functions  Logical Operators