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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConditionalMove

func ConditionalMove(ctx *build.Context, y, x Int, c operand.Op)

ConditionalMove copies x into y if c ≡ 1.

func Copy

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

Copy copies x to y with 64-bit move instructions. If x and y are different sizes it will copy to the smaller size.

func Mul

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

Mul does a full multiply z = x*y.

func Sqr

func Sqr(ctx *build.Context, z, x Int)

Sqr does a full square z = x².

Types

type Int

type Int []operand.Op

Int represents a multi-precision integer.

func AllocLocal

func AllocLocal(ctx *build.Context, k int) Int

AllocLocal allocates an integer with k 64-bit limbs on the stack of the currently active function.

func CopyIntoRegisters

func CopyIntoRegisters(ctx *build.Context, x Int) Int

CopyIntoRegisters will copy x into registers.

func Imm

func Imm(c *big.Int, k int) (Int, error)

Imm returns an integer representing the big integer constant c with k 64-bit limbs.

func ImmUint

func ImmUint(c uint, k int) (Int, error)

ImmUint returns an integer representing the unsigned integer constant c with k 64-bit limbs.

func NewInt

func NewInt(k int) Int

NewInt builds an empty integer with k limbs.

func NewIntFromMem

func NewIntFromMem(m operand.Mem, k int) Int

NewIntFromMem builds a multi-precision integer referencing the k 64-bit limbs at memory address m.

func NewIntLimb64

func NewIntLimb64(ctx *build.Context, k int) Int

NewIntLimb64 builds multi-precision integer with k 64-bit limbs.

func NewIntZero

func NewIntZero(k int) Int

NewIntZero builds an integer with all k limbs set to the immediate value 0.

func Param

func Param(ctx *build.Context, name string, k int) Int

Param builds a multi-precision integer from a function parameter. The parameter is expected to be a pointer to the start of the integer.

func StaticGlobal

func StaticGlobal(ctx *build.Context, name string, limbs []uint64) Int

StaticGlobal returns a multi-precision integer stored in a static global data section.

func (Int) Extend

func (x Int) Extend(limbs ...operand.Op) Int

Extend returns a new integer with limbs appended to the end.

func (Int) Limb

func (x Int) Limb(i int) operand.Op

Limb returns the ith limb of x, or the immediate value 0 if i ⩾ len(x).

Jump to

Keyboard shortcuts

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