Bit Shift

Shifts the bits in a number to the left or right

Syntax

result = Bit Shift (value,shift)

Description

This command will move (also known as shift) the bits in a number to the left or right.

If you pass in a positive shift, the bits in value will be shifted to the left, making the number bigger. If you pass in a negative shift the bits will be shifted to the right making it smaller.

Each bit shifted will either increase or decrease the value by a power of two. Eg a shift of 1 to the left will double the value, and a shift to 2 to the right will quarter it.

See also the Bit Set, Bit Test, Bit And, Bit Or and Bit Xor commands.

Table of contents