Documentation
¶
Overview ¶
Package complement implements conversion from one and two's complement numbers to their native representation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ones ¶
Ones parses an 8-bit one's complement number into a native integer. The returned value has range -127 through 127 (one's complement has both positive and negative 0).
func Twos ¶
Twos parses two's complement numbers of up to 16 bits into a native integer. The input is two bytes in big-endian order, and the number of bits the binary representation is expected to be (0 through 16). More significant bits above this must be 0, e.g. Twos([...]byte{0b000000xx, 0bxxxxxxxx}, 10).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.