Bit32.arshift

From GiderosMobile
Revision as of 18:39, 22 January 2023 by MoKaLux (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2022.3<br/> '''Class:''' bit32<br/> === Description === Returns the number x shifted disp bits to the right. The number disp may...")
(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