futil

package
v0.0.0-...-95aab37 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2021 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adc

func Adc(a, b, carry uint64) (uint64, uint64)

Adc Computes a + b + carry, returning the result and the new carry over.

func Load4

func Load4(b []byte) uint64

Load4 interprets a 4-byte unsigned little endian byte-slice as uint64

func Mac

func Mac(a, b, c, carry uint64) (uint64, uint64)

Mac Computes a + (b * c) + carry, returning the result and the new carry over.

func Sbb

func Sbb(a, b, borrow uint64) (uint64, uint64)

Sbb Computes a - (b + borrow), returning the result and the new borrow.

Types

type Uint128

type Uint128 struct{ H, L uint64 }

func FromU64

func FromU64(a uint64) *Uint128

FromU64 converts a uint64 into a uint128

func (*Uint128) Add

func (u *Uint128) Add(n uint64) *Uint128

Add adds uint64 to u

func (*Uint128) AddU128

func (u *Uint128) AddU128(o *Uint128) *Uint128

func (*Uint128) Mul

func (u *Uint128) Mul(a *Uint128) *Uint128

Mul multiplies two Uint128 numbers

func (*Uint128) MulU64

func (u *Uint128) MulU64(n uint64) *Uint128

MulU64 multiplies a uint64 with a uint128

func (*Uint128) Sub

func (u *Uint128) Sub(n uint64) *Uint128

Sub subs a uint64 number from u

func (*Uint128) SubU128

func (u *Uint128) SubU128(o *Uint128) *Uint128

func (*Uint128) ToU64

func (u *Uint128) ToU64() uint64

ToU64 converts a uint128 into a uint64 by keeping the lower bits

Jump to

Keyboard shortcuts

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