Operators: <<

Left shift operator.

Syntax

integer‑operand<<integer‑operand

Bitwise left shift

The operator << shifts the left signed integer or unsigned integer operand bitwise to the left, where the number of bits to shift is determined by the right operand. All bits shifted off to the left are discarded and the resulting value is zero filled from the right. The operation results in the data type corresponding to the left operand. For example:

var uint32 a = 0x00AA5500; var int32 b = -11162880; var int32 c = 4; var int32 d = 0; var int32 e = -1; var uint32 result = a << c; // result = 0x0AA55000 var uint32 result = a << d; // result = 0x00AA5500 var uint32 result = a << e; // result = 0x00000000 var int32 result = b << c; // result = -178606080 var int32 result = b << d; // result = -11162880 var int32 result = b << e; // result = 0