mp

package
v0.0.0-...-3948e75 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package mp provides multi-precision operations for arithmetic programs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(ctx *build.Context, x, y ir.Int) ir.Int

Add x and y, returning an integer with size the larger of x and y.

func AddFull

func AddFull(ctx *build.Context, x, y ir.Int) ir.Int

AddFull adds x and y, returning an integer with one more limb than the larger of x and y.

func AddInto

func AddInto(ctx *build.Context, z, x, y ir.Int, c ir.Register)

AddInto sets z = x+y using carry register c.

func ConditionalMove

func ConditionalMove(ctx *build.Context, dst, src ir.Int, f ir.Operand, eq ir.Flag)

ConditionalMove moves src to dst if f≡eq.

func MulInto

func MulInto(ctx *build.Context, z, x, y ir.Int)

MulInto sets z = x*y.

func SubInto

func SubInto(ctx *build.Context, z, x, y ir.Int, b ir.Register)

SubInto sets z = x-y using borrow register b.

Types

type Accumulator

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

func NewAccumulator

func NewAccumulator(ctx *build.Context, dst ir.Int) *Accumulator

func (*Accumulator) AddAt

func (a *Accumulator) AddAt(y ir.Int, i int)

AddAt adds a into the accumulator starting at limb i. Assumes the maximum possible value of y.

func (*Accumulator) AddAtMax

func (a *Accumulator) AddAtMax(y ir.Int, max *big.Int, i int)

AddAtMax adds a into the accumulator starting at limb i, assuming that the registers have maximum value max.

func (*Accumulator) AddProduct

func (a *Accumulator) AddProduct(hi, lo ir.Operand, i int)

AddProduct is a convenience for adding the high and low parts of a product into the accumulator.

func (*Accumulator) Flush

func (a *Accumulator) Flush()

func (*Accumulator) Int

func (a *Accumulator) Int() ir.Int

Int returns the value in the accumulator.

Jump to

Keyboard shortcuts

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