bitutils

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GillhamToAltitude added in v0.6.0

func GillhamToAltitude(d1, d2, d4, a1, a2, a4, b1, b2, b4, c1, c2, c4 bool) (int32, error)

GillhamToAltitude convert an altitude given in Gillham bits to an altitude in feet

func Pack16Bits added in v0.3.0

func Pack16Bits(b15, b14, b13, b12, b11, b10, b9, b8, b7, b6, b5, b4, b3, b2, b1, b0 bool) uint16

Pack16Bits packs 16 bytes in a single uint16.

Params:

  • b15: the first bit (MSB)
  • bn: ...
  • b0: the last bit (LSB)

The bits are packed as b15 b14 ... b1 b0

Return the packed byte

func Pack2Bytes

func Pack2Bytes(b1 byte, b0 byte) uint16

Pack2Bytes packs 2 bytes in a single uint16.

Params:

  • b1: the first bit
  • b0: the second bit

The two bytes are packed as b1 b1 ... b1 b1 b0 b0 ... b0 b0

Return the packed byte

func Pack3Bytes

func Pack3Bytes(b2 byte, b1 byte, b0 byte) uint32

Pack3Bytes packs 3 bytes in a single uint32.

Params:

  • b2: the first bit
  • b1: the second bit
  • b0: the third bit

The two bytes are packed as b2 b2 ... b2 b2 b1 b1 ... b1 b1 b0 b0 ... b0 b0

Return the packed byte

func Pack4Bytes

func Pack4Bytes(b3 byte, b2 byte, b1 byte, b0 byte) uint32

Pack4Bytes packs 4 bytes in a single uint32.

Params:

  • b3: the first bit
  • b2: the second bit
  • b1: the third bit
  • b0: the fourth bit

The two bytes are packed as b3 ... b3 b2 ... b2 b1 ... b1 b0 ... b0

Return the packed byte

func Pack8Bits added in v0.3.0

func Pack8Bits(b7, b6, b5, b4, b3, b2, b1, b0 bool) byte

Pack8Bits packs 8 bytes in a single byte.

Params:

  • b7: the first bit (MSB)
  • bn: ...
  • b0: the last bit (LSB)

The bits are packed as b7 b6 ... b1 b0

Return the packed byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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