polymerist.genutils.bits ======================== .. py:module:: polymerist.genutils.bits .. autoapi-nested-parse:: For bitwise operations and conversions to/from bitstrings Functions --------- .. autoapisummary:: polymerist.genutils.bits.int_to_bits Module Contents --------------- .. py:function:: int_to_bits(n: int, num_bits: int = 8, clamp: bool = False, as_list: bool = False) -> Union[str, list[int]] Convert an integer into a string of its bits, padded out to bits If clamp=True and the binary representation of has more than bits, then leading bits will be discarded If as_list=True, will return as list of 0/1 ints; otherwise, will return as string