Shl
Value = Shl ( Number , Bit )
Retorna Número deslocado para a esquerda por bits Bit. O sinal de Number é mantido.
O tipo de Number pode ser Byte, Short, Integer, ou Long.
A gama válida de Bit depende do tipo do argumento Number.
O tipo de dados do valor de retorno é o tipo de dados de Number.
Erros
Exemplos
PRINT Bin(11, 32), 11
PRINT Bin(Shl(11, 2), 32), Shl(11, 2)
PRINT Bin(Shl(11, 28), 32), Shl(11, 28)
00000000000000000000000000001011 11
00000000000000000000000000101100 44
00110000000000000000000000000000 805306368
PRINT Bin(-11, 32), -11
PRINT Bin(Shl(-11, 2), 32), Shl(-11, 2)
PRINT Bin(Shl(-11, 28), 32), Shl(-11, 28)
11111111111111111111111111110101 -11
11111111111111111111111111010100 -44
11010000000000000000000000000000 -805306368
Pode ser útil para expandir o tipo de um argumento.
Use para iss CLong, CInt ou CShort.
DIM b1 AS Byte
DIM i1 AS Integer
DIM i2 AS Integer
b1 = &H55
' Mau Argument, máximo = 7 por Byte para Integer : s2 = Shl(b1, 8) OR b2
i1 = Shl(CInt(b1), 16)
PRINT "i1="; Hex$(i1)
i2 = Shl(b1, 16) ' Pára aqui com Mau Argumento
PRINT " i2="; Hex$(i2)
i1=550000
Veja também