Skip to content
Bit operationsReference

bit.arshift

Shift right while preserving the sign bit of the 32-bit input.

Details#

Shift right while preserving the sign bit of the 32-bit input. A number in 0…4294967295 representing an unsigned 32-bit result.

Signature#

Luau
bit.arshift(value: number, count: number): number

Parameters#

ParameterTypeDescription
valuenumberNumber converted to 32 bits.
countnumberCount converted to uint32 and masked with 31, so 32 means 0.

Returns#

A number in 0…4294967295 representing an unsigned 32-bit result.

Examples#

Local example

Luau
print(bit.arshift(0x80000000, 1)) -- 3221225472