Yuari
Documentation
Docs/Bit operations/bit.lshift

bit.lshift

Left, logical right and arithmetic right shifts.

Syntax

bit.lshift(a: any, n: any) -> nil

Parameters

ParameterTypeDescription
aanyThe a value used by the call.
nanyThe n value used by the call.

Returns

TypeDescription
nilThis function does not return a value.

Description

bit.lshift is part of the Bit operations library. The bit library performs 32-bit integer arithmetic with Luau bit32 semantics; inputs and results are normalized to 32 bits.

The operation is performed immediately using the arguments supplied at the call site.

The aliases bit.rshift(a, n), bit.arshift(a, n) resolve to the same implementation.

Example

print(bit.lshift(1, 4), bit.rshift(16, 2), bit.arshift(0xFFFFFFF0, 4))

Notes

  • Aliases: bit.rshift(a, n), bit.arshift(a, n).
  • Values are normalized to 32-bit integers before and after each operation.