bigint

package
v0.0.0-...-99d40e0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package bigint implements utilities for dealing with arbitrary precision integers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSlice

func FormatSlice(s []*big.Int) string

FormatSlice formats a slice of *big.Int to a space separated string.

func ToInt

func ToInt(x *big.Int) (int, bool)

ToInt converts a *big.Int x to an int and returns whether x can be contained within int.

func ToInt32

func ToInt32(x *big.Int) (int32, bool)

ToInt32 converts a *big.Int to an int32 and returns whether x can be contained within int32.

func ToInt64

func ToInt64(x *big.Int) (int64, bool)

ToInt64 converts a *big.Int to an int64 and returns whether x can be contained within int64.

func ToRune

func ToRune(x *big.Int) rune

ToRune converts a *big.Int x to a rune. When x is not a valid UTF-8 codepoint, U+FFFD � replacement character is returned.

func ToUint

func ToUint(x *big.Int) (uint, bool)

ToUint converts a *big.Int x to a uint and returns whether x can be contained within uint.

func ToUint32

func ToUint32(x *big.Int) (uint32, bool)

ToUint32 converts a *big.Int to a uint32 and returns whether x can be contained within uint32.

func ToUint64

func ToUint64(x *big.Int) (uint64, bool)

ToUint64 converts a *big.Int to a uint64 and returns whether x can be contained within uint64.

Types

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map is a hash table for big int keys. Keys are not copied and must not be changed after insertion.

func NewMap

func NewMap() *Map

NewMap constructs a Map.

func (*Map) Get

func (m *Map) Get(key *big.Int) (interface{}, bool)

Get the value at the key.

func (*Map) GetOrPut

func (m *Map) GetOrPut(key *big.Int, v interface{}) (interface{}, bool)

GetOrPut gets the value at the key, if it exists, or otherwise puts a value at the key.

func (*Map) GetOrPutPair

func (m *Map) GetOrPutPair(key *big.Int, v interface{}) (MapPair, bool)

GetOrPutPair gets the key-value pair at the key, if it exists, or otherwise puts a value at the key.

func (*Map) GetPair

func (m *Map) GetPair(key *big.Int) (MapPair, bool)

GetPair gets the key-value pair at the key.

func (*Map) Has

func (m *Map) Has(key *big.Int) bool

Has returns whether the key exists.

func (Map) Len

func (m Map) Len() int

Len returns the number of elements in the map.

func (*Map) Pairs

func (m *Map) Pairs() []MapPair

Pairs returns a sorted slice of the key-value pairs in the map.

func (*Map) Put

func (m *Map) Put(key *big.Int, v interface{}) bool

Put a value at the key.

func (Map) String

func (m Map) String() string

type MapPair

type MapPair struct {
	K *big.Int
	V interface{}
}

MapPair is a key-value pair.

Jump to

Keyboard shortcuts

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