complement

package
v0.0.0-...-9d76940 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2023 License: LGPL-3.0 Imports: 0 Imported by: 0

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

func Ones(b byte) int8

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

func Twos(bigEndian [2]byte, bits uint8) int16

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL