twosComplement

pyrogue.twosComplement(value, bitSize)[source]

Compute the two’s complement of an integer value. For example, if value = 0b1010 and bitSize = 4, then the function will return 0b0110.

Parameters:
  • value (int) – Input value.

  • bitSize (int) – Bit width of the value.

Returns:

Two’s complement value.

Return type:

int