bit. rshift Synchronous
Move bits right and fill the high positions with zeroes. Combine it with a mask to read a field from a packed integer.
Luau
bit.rshift(value: number, count: number) -> numberParameters
| Parameter | Type | Description |
|---|---|---|
value | number | Finite number to truncate and interpret as an unsigned 32-bit value. |
count | number | Shift or rotation count, normalized to 32 bits and masked with 31. Counts 32 and 0 therefore perform the same operation. |
Returns
numberThe 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
Luau
local packed = 0x1234
print(bit.tohex(bit.band(bit.rshift(packed, 8), 0xff))) -- 12