Skip to main content

Int64

SnarkyJS / Modules / Int64

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


one

Static get one(): Int64

Static method to create a Int64 with value 1.

Returns

Int64

Defined in

lib/int.ts:854


zero

Static get zero(): Int64

Static method to create a Int64 with value 0.

Returns

Int64

Defined in

lib/int.ts:848

Methods

add

add(y): Int64

Addition with overflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:894


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


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


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


isConstant

isConstant(): boolean

Returns

boolean

Overrides

CircuitValue.isConstant

Defined in

lib/int.ts:837


isPositive

isPositive(): Bool

Checks if the value is postive.

Returns

Bool

Defined in

lib/int.ts:958


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


mul

mul(y): Int64

Multiplication with overflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:908


neg

neg(): Int64

Negates the value.

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

Returns

Int64

Defined in

lib/int.ts:887


sub

sub(y): Int64

Subtraction with underflow checking.

Parameters

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

Returns

Int64

Defined in

lib/int.ts:901


toConstant

toConstant(): Int64

Returns

Int64

Inherited from

CircuitValue.toConstant

Defined in

lib/circuit_value.ts:150


toField

toField(): Field

Returns the Field value.

Returns

Field

Defined in

lib/int.ts:867


toFields

toFields(): Field[]

Returns

Field[]

Inherited from

CircuitValue.toFields

Defined in

lib/circuit_value.ts:142


toJSON

toJSON(): any

Returns

any

Inherited from

CircuitValue.toJSON

Defined in

lib/circuit_value.ts:146


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


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


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


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


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


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


toAuxiliary

Static toAuxiliary(): []

Returns

[]

Inherited from

CircuitValue.toAuxiliary

Defined in

lib/circuit_value.ts:116


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


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


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


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