<< Operator

Purpose

Shifts a bit pattern left.

Syntax

i = m << n

Description

m<<n shifts the bit pattern of a 32-bit integer expression m, n places left and thereby changes the value in m.

Example

Print Bin$(202, 16)      // Prints 0000000011001010

Print Bin$(202 << 4, 16) // Prints 0000110010100000

Remarks

Shl(m, n) is synonymous with m<<n and can be used instead. As long as the result of the shift does not exceed the given width, m<<n is equivalent to a multiplication of m with 2^n.

See Also

Shl, Shr, Sar, Rol, Ror, >>, Operator Hierarchy

{Created by Sjouke Hamstra; Last updated: 23/09/2014 by James Gaite}