u24

package
v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MaxUint24 = 16777215

MaxUint24 is the max value of Uint24.

Variables

This section is empty.

Functions

func IsExceedMaximumUint24Error

func IsExceedMaximumUint24Error(err error) bool

IsExceedMaximumUint24Error returns true if exceed maximum Uint24. (16777215)

func IsNegativeUint24Error

func IsNegativeUint24Error(err error) bool

IsNegativeUint24Error returns true if number is negative.

func ReadUint24ToInt added in v0.7.5

func ReadUint24ToInt(p []byte) int

ReadUint24ToInt reads bytes then decode to int.

func WriteUint24

func WriteUint24(w io.Writer, n int) error

WriteUint24 encode and write Uint24 to an io.Writer.

Types

type Uint24

type Uint24 [3]byte

Uint24 is 3 bytes unsigned integer.

func MustNewUint24

func MustNewUint24(n int) Uint24

MustNewUint24 returns a new uint24.

func NewUint24

func NewUint24(v int) (n Uint24, err error)

NewUint24 returns a new uint24.

func NewUint24Bytes

func NewUint24Bytes(bs []byte) Uint24

NewUint24Bytes returns a new uint24 from bytes.

func (Uint24) AsInt

func (p Uint24) AsInt() int

AsInt converts to int.

func (Uint24) Bytes

func (p Uint24) Bytes() []byte

Bytes returns bytes encoded.

func (Uint24) WriteTo

func (p Uint24) WriteTo(w io.Writer) (int64, error)

WriteTo encode and write bytes to a writer.

Jump to

Keyboard shortcuts

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