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:785

Properties

magnitude

magnitude: UInt64

Implementation of

BalanceChange.magnitude

Defined in

lib/int.ts:762


sgn

sgn: Sign

Implementation of

BalanceChange.sgn

Defined in

lib/int.ts:763

Accessors

minusOne

Static get minusOne(): Int64

Static method to create a Int64 with value -1.

Returns

Int64

Defined in

lib/int.ts:861


one

Static get one(): Int64

Static method to create a Int64 with value 1.

Returns

Int64

Defined in

lib/int.ts:855


zero

Static get zero(): Int64

Static method to create a Int64 with value 0.

Returns

Int64

Defined in

lib/int.ts:849

Methods

add

add(y): Int64

Addition with overflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:895


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:949


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:920


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:942


isConstant

isConstant(): boolean

Returns

boolean

Overrides

CircuitValue.isConstant

Defined in

lib/int.ts:838


isPositive

isPositive(): Bool

Checks if the value is postive.

Returns

Bool

Defined in

lib/int.ts:959


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:932


mul

mul(y): Int64

Multiplication with overflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:909


neg

neg(): Int64

Negates the value.

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

Returns

Int64

Defined in

lib/int.ts:888


sub

sub(y): Int64

Subtraction with underflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:902


toConstant

toConstant(): Int64

Returns

Int64

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:167


toField

toField(): Field

Returns the Field value.

Returns

Field

Defined in

lib/int.ts:868


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:159


toJSON

toJSON(): any

Returns

any

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:163


toString

toString(): string

Turns the Int64 into a string.

Returns

string

Defined in

lib/int.ts:832


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:208


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:822


fromField

Static fromField(x): Int64

Static method to create a Int64 from a Field.

Parameters

NameType
xField

Returns

Int64

Defined in

lib/int.ts:874


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:794


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:183


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:241


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:104


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:812


sizeInFields

Static sizeInFields(): number

Returns

number

Inherited from

CircuitValue.sizeInFields

Defined in

lib/circuit_value.ts:111


toAuxiliary

Static toAuxiliary(): []

Returns

[]

Inherited from

CircuitValue.toAuxiliary

Defined in

lib/circuit_value.ts:133


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:222


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:116


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:137


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:230