Library bit

Bitwise library

Functions

arshift (value, shiftCount) Arithmetic shift right
band (value1, ...) Bitwise and
bnot (value) Bitwise not Negates every bit
bor (value1, ...) Bitwise or
bswap (value) Swaps byte order
bxor (value1, ...) Bitwise xor
lshift (value, shiftCount) Shift left
rol (value, shiftCount) Rotate left
ror (value, shiftCount) Rotate right
rshift (value, shiftCount) Shift right
tobit (value) Clamps to 32-bit integer
tohex (value, digits) Returns the hexadecimal representation of the value


Functions

bit_library.arshift (value, shiftCount)
Arithmetic shift right

Parameters:

  • value: Value to be modified
  • shiftCount: Amounts of bits to shift

Return value:

    Shifted value
bit_library.band (value1, ...)
Bitwise and

Parameters:

  • value1: First value
  • ...: More values

Return value:

    Bitwise and of all values
bit_library.bnot (value)
Bitwise not Negates every bit

Parameters:

  • value: Value to be modified

Return value:

    Negated value
bit_library.bor (value1, ...)
Bitwise or

Parameters:

  • value1: First value
  • ...: More values

Return value:

    Bitwise or of all values
bit_library.bswap (value)
Swaps byte order

Parameters:

  • value: Value to be modified

Return value:

    Value with swapped byte order
bit_library.bxor (value1, ...)
Bitwise xor

Parameters:

  • value1: First value
  • ...: More values

Return value:

    Bitwise xor of all values
bit_library.lshift (value, shiftCount)
Shift left

Parameters:

  • value: Value to be modified
  • shiftCount: Amounts of bits to shift

Return value:

    Shifted value
bit_library.rol (value, shiftCount)
Rotate left

Parameters:

  • value: Value to be modified
  • shiftCount: Amounts of bits to shift

Return value:

    Rotated value
bit_library.ror (value, shiftCount)
Rotate right

Parameters:

  • value: Value to be modified
  • shiftCount: Amounts of bits to shift

Return value:

    Rotated value
bit_library.rshift (value, shiftCount)
Shift right

Parameters:

  • value: Value to be modified
  • shiftCount: Amounts of bits to shift

Return value:

    Shifted value
bit_library.tobit (value)
Clamps to 32-bit integer

Parameters:

  • value: Value to be modified

Return value:

    Clamped value
bit_library.tohex (value, digits)
Returns the hexadecimal representation of the value

Parameters:

  • value: Value
  • digits: Amounts of digits. Optional.

Return value:

    Hexadecimal representation

Valid XHTML 1.0!