quri_parts.core.utils.bit module#

quri_parts.core.utils.bit.bit_length(bits: int | int8 | int16 | int32 | int64) int#

Computes the bit length of an integer.

quri_parts.core.utils.bit.get_bit(x: int, index: int) bool#

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

quri_parts.core.utils.bit.different_bit_index(x: int, y: int) int#

Returns the index of the lowest different bit.

quri_parts.core.utils.bit.lowest_bit_index(x: int) int#

Returns the index of the lowest bit that is set.

quri_parts.core.utils.bit.parity_sign_of_bits(bits: int) int#

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