hidtools.util module

to_twos_comp(val, bits)
twos_comp(val, bits)

compute the 2’s complement of val.

Parameters
  • val (int) – the value to compute the two’s complement for

  • bits (int) – size of val in bits