uint128

package
v0.0.0-...-07c73bd Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2020 License: BSD-2-Clause Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Uint128

type Uint128 struct {
	Hi, Lo uint64
}

Uint128 is a big-endian 128 bit unsigned integer which wraps two uint64s.

func FromBytes

func FromBytes(b []byte) Uint128

FromBytes parses the byte slice as a 128 bit big-endian unsigned integer.

func FromInts

func FromInts(hi uint64, lo uint64) Uint128

FromInts takes in two unsigned 64-bit integers and constructs a Uint128.

func FromString

func FromString(s string) (Uint128, error)

FromString parses a hexadecimal string as a 128-bit big-endian unsigned integer.

func (Uint128) Add

func (u Uint128) Add(n Uint128) Uint128

Add returns a new Uint128 incremented by n.

func (Uint128) Compare

func (u Uint128) Compare(o Uint128) int

Compare compares the two Uint128.

func (Uint128) Equal

func (u Uint128) Equal(o Uint128) bool

Equal returns whether or not the Uint128 are equivalent.

func (Uint128) GetBytes

func (u Uint128) GetBytes() []byte

GetBytes returns a big-endian byte representation.

func (Uint128) String

func (u Uint128) String() string

String returns a hexadecimal string representation.

func (Uint128) Sub

func (u Uint128) Sub(n Uint128) Uint128

Jump to

Keyboard shortcuts

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