Bit32.rrotate

From GiderosMobile
Revision as of 15:26, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")

Available since: Gideros 2022.3
Class: bit32

Description

Returns a number after its bits have been rotated to the right by a given number of times. <syntaxhighlight lang="lua"> (number) = bit32.rrotate(x,disp) </source>

Returns the number x rotated disp bits to the right.

The number disp may be any representable integer. For any valid displacement, the following identity holds: <syntaxhighlight lang="lua"> assert(bit32.rrotate(x, disp) == bit32.rrotate(x , disp % 32)) </source>

Negative displacements rotate to the left

Parameters

x: (number) value
disp: (number) displacement

Return values

Returns (number) result after bits right rotation

See also

Bitwise Operators