#
bit
This is an expansion to the existing Lua Bit library.
Expansion Library
This is an expansion to builtins provided by Lua itself, see more about them on the official Lua/LuaJIT wikis.
#
Functions
bit.arshift(v: number, count: number): number
- Returns the arithmetically shifted value.
bit.band(...: number): number
- Performs the bitwise and for all values specified.
bit.bnot(v: number): number
- Returns the bitwise not of the value.
bit.bor(...: number): number
- Returns the bitwise OR of all values specified.
bit.bswap(v: number): number
- Swaps the byte order.
bit.bxor(v: number, other?: number): number
- Returns the bitwise xor of all values specified.
bit.lshift(v: number, count: number): number
- Returns the left shifted value.
bit.rol(v: number, count: number): number
- Returns the left rotated value.
bit.ror(v: number, count: number): number
- Returns the right rotated value.
bit.rshift(v: number, count: number): number
- Returns the right shifted value.
bit.tobit(v: number): number
- Normalizes the specified value and clamps it in the range of a signed 32bit integer.
bit.tohex(v: number, chars: number = 8): string
- Returns the hexadecimal representation of the number with the specified number of characters.