Bit32.arshift

From GiderosMobile
Revision as of 14:27, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "</source>" to "</syntaxhighlight>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2022.3
Class: bit32

Description

Returns the number x shifted disp bits to the right. The number disp may be any representable integer. Negative displacements shift to the left.

(number) = bit32.arshift(x,disp)
This shift operation is what is called arithmetic shift. Vacant bits on the left are filled with copies of the higher bit of x; vacant bits on the right are filled with zeros. In particular, displacements with absolute values higher than 31 result in zero or 0xFFFFFFFF (all original bits are shifted out)

Parameters

x: (number) the number whose bits shall be shifted
disp: (number) the integer number of bits to shift by

Return values

Returns (number) result

See also

Bitwise Operators