bit.arshift Synchronous

Move bits right while repeating the original high bit in the vacated positions. Use it for a signed bit pattern; the returned Luau number still represents an unsigned 32-bit value.

Syntax
Luau
bit.arshift(value: number, count: number) -> number

Parameters

Function parameters
ParameterTypeDescription
valuenumberFinite number to truncate and interpret as an unsigned 32-bit value.
countnumberShift or rotation count, normalized to 32 bits and masked with 31. Counts 32 and 0 therefore perform the same operation.

Returns

number

The resulting unsigned 32-bit value.

Differences from Volt

Volt documents its Bit Library setting as disabled by default. Kawaii enables bit by default. Disabling the setting removes the bit global and makes retained function references reject calls.

Availability

Bit is enabled by default. The bit global is removed when disabled, and its operations check the setting.

Example

Example
Luau
print(bit.tohex(bit.arshift(0x80000000, 1))) -- c0000000
print(bit.tohex(bit.rshift(0x80000000, 1))) -- 40000000
Kawaii documentation