bit.arshift Synchronous

Shift right while copying the original sign bit into the newly opened high positions. This preserves the sign pattern of a signed 32-bit value, though the result is still returned as unsigned.

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

Parameters

Function parameters
ParameterTypeDescription
valuenumberFinite number truncated and normalized to unsigned 32 bits.
countnumberFinite count normalized to 32 bits, then masked with 31. A count of 32 has the same effect as 0.

Returns

number

An unsigned 32-bit result represented as a Luau number.

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
Kawaii documentation