SplitScript reference / Integer / shiftLeft

Integer.shiftLeft

Operator

T.shiftLeft(count: T) -> T where T: Integer

Shifts bits to the left.

This method is also the implementation of the << operator. Only the low five bits of the shift count are used for values represented as i32, including 8- and 16-bit integers; i64, u64, and address values use the low six bits. Bits shifted out of the representation are discarded.

Parameters

  • count: The shift count, inferred as the receiver's integer type.

Effects: pure

Runtime behavior: available everywhere; synchronous

Examples

Construct a bit mask

let mask = 1u32 << 5