Skip to main content

Class: Int64

A 64 bit signed integer with values ranging from -18,446,744,073,709,551,615 to 18,446,744,073,709,551,615.

Hierarchy

Implements

  • BalanceChange

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Int64(magnitude, sgn?)

Parameters

NameTypeDefault value
magnitudeUInt64undefined
sgnSignSign.one

Overrides

CircuitValue.constructor

Defined in

lib/int.ts:780

Properties

magnitude

magnitude: UInt64

Implementation of

BalanceChange.magnitude

Defined in

lib/int.ts:757


sgn

sgn: Sign

Implementation of

BalanceChange.sgn

Defined in

lib/int.ts:758

Accessors

minusOne

Static get minusOne(): Int64

Static method to create a Int64 with value -1.

Returns

Int64

Defined in

lib/int.ts:856


one

Static get one(): Int64

Static method to create a Int64 with value 1.

Returns

Int64

Defined in

lib/int.ts:850


zero

Static get zero(): Int64

Static method to create a Int64 with value 0.

Returns

Int64

Defined in

lib/int.ts:844

Methods

add

add(y): Int64

Addition with overflow checking.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:890


assertEquals

assertEquals(y, message?): void

Asserts that two values are equal.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64
message?string

Returns

void

Overrides

CircuitValue.assertEquals

Defined in

lib/int.ts:944


div

div(y): Int64

Integer division.

x.div(y) returns the floor of x / y, that is, the greatest z such that z * y <= x.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:915


equals

equals(y): Bool

Checks if two values are equal.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Bool

Overrides

CircuitValue.equals

Defined in

lib/int.ts:937


isConstant

isConstant(): boolean

Returns

boolean

Overrides

CircuitValue.isConstant

Defined in

lib/int.ts:833


isPositive

isPositive(): Bool

Checks if the value is postive.

Returns

Bool

Defined in

lib/int.ts:954


mod

mod(y): Int64

Integer remainder.

x.mod(y) returns the value z such that 0 <= z < y and x - z is divisble by y.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32

Returns

Int64

Defined in

lib/int.ts:927


mul

mul(y): Int64

Multiplication with overflow checking.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:904


neg

neg(): Int64

Negates the value.

Int64.from(5).neg() will turn into Int64.from(-5)

Returns

Int64

Defined in

lib/int.ts:883


sub

sub(y): Int64

Subtraction with underflow checking.

Parameters

NameType
ystring | number | bigint | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:897


toConstant

toConstant(): Int64

Returns

Int64

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:154


toField

toField(): Field

Returns the Field value.

Returns

Field

Defined in

lib/int.ts:863


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:146


toJSON

toJSON(): any

Returns

any

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:150


toString

toString(): string

Turns the Int64 into a string.

Returns

string

Defined in

lib/int.ts:827


check

Static check<T>(this, v): void

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
vInstanceType<T>

Returns

void

Inherited from

CircuitValue.check

Defined in

lib/circuit_value.ts:195


from

Static from(x): Int64

Creates a new Int64.

Check the range if the argument is a constant.

Parameters

NameType
xstring | number | bigint | Field | UInt64 | UInt32 | Int64

Returns

Int64

Defined in

lib/int.ts:817


fromField

Static fromField(x): Int64

Static method to create a Int64 from a Field.

Parameters

NameType
xField

Returns

Int64

Defined in

lib/int.ts:869


fromFieldUnchecked

Static Private fromFieldUnchecked(x): Int64

Creates a new Int64 from a Field.

Does check if the Field is within range.

Parameters

NameType
xField

Returns

Int64

Defined in

lib/int.ts:789


fromFields

Static fromFields<T>(this, xs): InstanceType<T>

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
xsField[]

Returns

InstanceType<T>

Inherited from

CircuitValue.fromFields

Defined in

lib/circuit_value.ts:170


fromJSON

Static fromJSON<T>(this, value): InstanceType<T>

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
valueany

Returns

InstanceType<T>

Inherited from

CircuitValue.fromJSON

Defined in

lib/circuit_value.ts:228


fromObject

Static fromObject<T>(this, value): InstanceType<T>

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
valueNonMethods<InstanceType<T>>

Returns

InstanceType<T>

Inherited from

CircuitValue.fromObject

Defined in

lib/circuit_value.ts:91


fromUnsigned

Static fromUnsigned(x): Int64

Creates a new Int64 from a Field.

Does not check if the Field is within range.

Parameters

NameType
xUInt64 | UInt32

Returns

Int64

Defined in

lib/int.ts:807


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:98


toAuxiliary

Static toAuxiliary(): []

Returns

[]

Inherited from

CircuitValue.toAuxiliary

Defined in

lib/circuit_value.ts:120


toConstant

Static toConstant<T>(this, t): InstanceType<T>

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
tInstanceType<T>

Returns

InstanceType<T>

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:209


toFields

Static toFields<T>(this, v): Field[]

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
vInstanceType<T>

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:103


toInput

Static toInput<T>(this, v): HashInput

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
vInstanceType<T>

Returns

HashInput

Inherited from

CircuitValue.toInput

Defined in

lib/circuit_value.ts:124


toJSON

Static toJSON<T>(this, v): any

Type parameters

NameType
Textends AnyConstructor

Parameters

NameType
thisT
vInstanceType<T>

Returns

any

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:217