Bit

Utility library for performing bitwise operations.


Source: pkg/lua/lib/bit.go | Import: bit

Functions


bitor

bitor(a, b) -> int

Arguments

  • a int
  • b int
Return Values

  • int - The result of (a | b).
bitor_many

bitor_many(operands...) -> int

Arguments

  • operands int...
Return Values

  • int - The result of all operands on (0 | operand[1] | operand[2]...).
bitand

bitand(a, b) -> int

Arguments

  • a int
  • b int
Return Values

  • int - The result of (a & b).
bitxor

bitxor(a, b) -> int

Arguments

  • a int
  • b int
Return Values

  • int - The result of (a ^ b).
bitclear

bitclear(a, b) -> int

Equivalent to (a & (~b)). Keeps the bits in 'a' where the bit in 'b' is 0, otherwise the bit is 0.

Arguments

  • a int
  • b int
Return Values

  • int - The result of (a &^ b).
bitnot

bitnot(a) -> int

Arguments

  • a int
Return Values

  • int - The result of (^a).
bit_rshift

bit_rshift(a, b) -> int

Arguments

  • a int
  • b int
Return Values

  • int - The result of (a >> b).
bit_lshift

bit_lshift(a, b) -> int

Arguments

  • a int
  • b int
Return Values

  • int - The result of (a << b).
byte_string

byte_string(nums...) -> string

Arguments

  • nums int... - A list of numbers to convert to bytes. These will be treated as uint8.
Return Values

  • string - The byte string representation of the numbers.