Skip to content

Math.LShift

Name Mandatory Description Default Type
⬅️ Input The integer or the sequence of integers to shift the bits of. IntInt2Int3Int4Int8Int16Color[Any]
Output ➡️ Outputs the value resulting from the left shift operation. IntInt2Int3Int4Int8Int16Color[Any]
Operand No The number of positions to shift the bits of the input value to the left by. 0 IntInt2Int3Int4Int8Int16Color[Any]

This shard shifts the bits of the input value to the left by the number of positions specified in the Operand parameter. The shard then outputs a value, whose binary representation is the resulting shifted binary.

Details

This shard can take an integer or a sequence of integers as input. However, depending on the type of input, the appropriate Operand needs to be provided:

For non-sequence inputs: The Operand must match the input type exactly (e.g., Int2 with Int2, Color with Color).

For sequence inputs: The Operand can be either: - A matching non-sequence type (e.g., sequence of Int2 with a single Int2 Operand). Each element of the input sequence is operated on by the Operand. - Another sequence of elements with the same types. Each element of the Operand sequence is applied to the corresponding element of the input sequence. If the input sequence is longer, the Operand sequence will loop over till all elements of the input sequence are operated on. If the Operand sequence is longer, the extra elements of the Operand sequence are ignored.

Examples

1
2
4 | Math.LShift(2) | Log
Assert.Is(16 Break: true)

[info] [sample-wire] 16