bit.shiftLeft

Syntax bit.shiftLeft (bits, ctShift)

Params bits is a 32-bit number.

ctShift is a number between 0 and 31

Action Shifts bits left ctShift times

Returns The shifted value.

Examples bit.shiftLeft (5, 2)

   » 20

string.hex (bit.shiftLeft (0x1FFFF, 2))

   » "0x0007FFFC"

string.hex (bit.shiftLeft (0x1FFFF, 20))

   » "0xFFF00000"

Notes Each left shift multiplies the value of bits by 2

Bits that overflow the shift operation are lost

See Also bit.shiftRight

bit.get

bit.logicalAnd

Discuss