SHL= Operator

Does a left-shift on the bits of a variable and assigns the result to the same variable.

Syntax

variable SHL= number

Parts

variable
A variable or property of an integer type. Integer types include Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Int128, and UInt128.
number
A numeric expression of a data type that widens to Int32.

Instructions

The two statements that follow operate the same.

variable SHL= number
variable = variable SHL number

The element on the left side of the operator SHL= can be a scalar variable, a property, or an element of an array. The variable or property cannot have the modifier @ReadOnly.

The operator SHL= first does an arithmetic left shift operation on the value of the variable or property. The operator then assigns the result of that operation back to the variable or property.

In an arithmetic left shift, the operation discards the given number of bits from the left side of the result. At the same time, the same number of bits on the right side are set to zero.

Examples

Var variable As Int32 = 10
variable SHL= 3
// variable is 80 (%x50).

variable = -1
variable SHL= 5
// variable is -32 (%xFFFFFFE0).

variable SHL= 27
// variable is 0.

See also