quri_parts.core.utils.bit module#

bit_length(bits)#

Computes the bit length of an integer.

Parameters:

bits (int | int8 | int16 | int32 | int64) –

Return type:

int

get_bit(x, index)#

Returns if the bit at ‘index’ is set or not.

Parameters:
  • x (int) –

  • index (int) –

Return type:

bool

different_bit_index(x, y)#

Returns the index of the lowest different bit.

Parameters:
  • x (int) –

  • y (int) –

Return type:

int

lowest_bit_index(x)#

Returns the index of the lowest bit that is set.

Parameters:

x (int) –

Return type:

int

parity_sign_of_bits(bits)#

Returns a sign corresponding to parity of bits (even=1, odd=-1).

Parameters:

bits (int) –

Return type:

int