bigint

package
v1.0.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package bigint implements a set of functions for big integer arithmetic.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnequallySizedSlices     = errors.New("operation not defined for differently sized slices")
	ErrSubtractionWithLeftovers = errors.New("could not subtract without leftovers")
)

Errors for bigint package.

Functions

func AddSmall

func AddSmall(b []uint32, a uint32) int

AddSmall adds a small number to a big int and returns the index of the last carry over.

func AddWithOverflow

func AddWithOverflow(lh, rh uint32) (uint, bool)

AddWithOverflow returns left hand + right hand and whether it overflowed.

func FullAdd

func FullAdd(lh, rh uint32, carry bool) (uint, bool)

FullAdd adds left and right together and whether it overflowed.

func IsNull

func IsNull(b []uint32) bool

IsNull checks whether the given big int value is null.

func MustAdd

func MustAdd(b []uint32, rh []uint32)

MustAdd adds the given big ints together.

func MustCmp

func MustCmp(lh, rh []uint32) int

MustCmp compares the given big ints with each other.

func MustSub

func MustSub(b []uint32, rh []uint32)

MustSub subtracts rh from b.

func Not

func Not(b []uint32)

Not negates the given big int value.

func Reverse

func Reverse(a []byte) []byte

Reverse reverses the given byte slice.

func ReverseU

func ReverseU(a []uint32) []uint32

ReverseU reverses the given uint32 slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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