LSH

Syntax

LSH integer integer

Explanation

LSH outputs the first input logically shifted the number of bit positions specified by the second input. If the second input is positive, the logical shift is to the right. If the second input is negative, the logical shift is to the left.

Examples

? LSH 2 1

Result: 1

?

2 in base 10 is 10 in base 2. 10 shifted one bit right is 1; 1 in base 2 is 1 in base 10.

? LSH 2 -1

Result: 4

?

2 in base 10 is 10 in base 2. 10 shifted one bit left is 100; 100 in base 2 is 4 in base 10.