Skip to content

komm.binlist2int

Converts a bit array to its integer representation (LSB first).

Parameters:

  • binlist (Iterable[int])

    A list or array of $0$'s and $1$'s whose $i$-th element stands for the coefficient of $2^i$ in the binary representation of the output integer.

Returns:

  • integer (int)

    The integer representation of the input bit array.

Examples:

>>> komm.binlist2int([0, 0, 0, 0, 1])
16
>>> komm.binlist2int([0, 1, 0, 1, 1])
26
>>> komm.binlist2int([0, 1, 0, 1, 1, 0, 0, 0])
26