Class nixio.bit

Bitfield operators and mainpulation functions. Can be used as a drop-in replacement for bitlib.

Functions

arshift (oper, shift) Arithmetically right shift a number.
band (oper1, oper2, ...) Bitwise AND several numbers.
bnot (oper) Invert given number.
bor (oper1, oper2, ...) Bitwise OR several numbers.
bxor (oper1, oper2, ...) Bitwise XOR several numbers.
cast (oper) Cast a number to the bit-operating range.
check (bitfield, flag1, ...) Checks whether given flags are set in a bitfield.
div (oper1, oper2, ...) Integer division of 2 or more numbers.
lshift (oper, shift) Left shift a number.
rshift (oper, shift) Right shift a number.
set (bitfield, flag1, ...) Sets one or more flags of a bitfield.
unset (bitfield, flag1, ...) Unsets one or more flags of a bitfield.


Functions

arshift (oper, shift)
Arithmetically right shift a number.

Parameters

  • oper: number
  • shift: bits to shift

Return value:

number
band (oper1, oper2, ...)
Bitwise AND several numbers.

Parameters

  • oper1: First Operand
  • oper2: Second Operand
  • ...: More Operands

Return value:

number
bnot (oper)
Invert given number.

Parameters

  • oper: Operand

Return value:

number
bor (oper1, oper2, ...)
Bitwise OR several numbers.

Parameters

  • oper1: First Operand
  • oper2: Second Operand
  • ...: More Operands

Return value:

number
bxor (oper1, oper2, ...)
Bitwise XOR several numbers.

Parameters

  • oper1: First Operand
  • oper2: Second Operand
  • ...: More Operands

Return value:

number
cast (oper)
Cast a number to the bit-operating range.

Parameters

  • oper: number

Return value:

number
check (bitfield, flag1, ...)
Checks whether given flags are set in a bitfield.

Parameters

  • bitfield: Bitfield
  • flag1: First Flag
  • ...: More Flags

Return value:

true when all flags are set, otherwise false
div (oper1, oper2, ...)
Integer division of 2 or more numbers.

Parameters

  • oper1: Operand 1
  • oper2: Operand 2
  • ...: More Operands

Return value:

number
lshift (oper, shift)
Left shift a number.

Parameters

  • oper: number
  • shift: bits to shift

Return value:

number
rshift (oper, shift)
Right shift a number.

Parameters

  • oper: number
  • shift: bits to shift

Return value:

number
set (bitfield, flag1, ...)
Sets one or more flags of a bitfield.

Parameters

  • bitfield: Bitfield
  • flag1: First Flag
  • ...: More Flags

Return value:

altered bitfield
unset (bitfield, flag1, ...)
Unsets one or more flags of a bitfield.

Parameters

  • bitfield: Bitfield
  • flag1: First Flag
  • ...: More Flags

Return value:

altered bitfield

Valid XHTML 1.0!