Bit32

Supported platforms: Platform android.pngPlatform ios.pngPlatform mac.pngPlatform pc.pngPlatform html5.pngPlatform winrt.pngPlatform win32.png
Available since: Gideros 2022.3

Description

This library is a back-ported feature from Lua 5.2 that provides functions to perform bitwise operations.

Methods

bit32.arshift returns a number after its bits have been arithmetically shifted to the right by a given displacement
bit32.band returns the bitwise and of its operands
bit32.bnot returns the bitwise negation of a given number
bit32.bor returns the bitwise or of its operands
bit32.btest returns a boolean describing whether the bitwise and of its operands is different from zero
bit32.bxor returns the bitwise exclusive or of its operands
bit32.countlz returns the number of consecutive zero bits in the 32-bit representation of the provided number starting from the left-most (most significant) bit
bit32.countrz returns the number of consecutive zero bits in the 32-bit representation of the provided number starting from the right-most (least significant) bit
bit32.extract extracts a range of bits from a number and return them as an unsigned number
bit32.lrotate returns a number after its bits have been rotated to the left by a given number of times
bit32.lshift returns a number whose bits have been logically shifted to the left by a given displacement
bit32.replace returns a copy of a number with a range of bits replaced by a given value
bit32.rrotate returns a number after its bits have been rotated to the right by a given number of times
bit32.rshift returns a number whose bits have been logically shifted to the right by a given displacement

Events

Constants