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
↳
Int64
Implements
BalanceChange
Table of contents
Constructors
Properties
Accessors
Methods
- add
- assertEquals
- div
- equals
- isConstant
- isPositive
- mod
- mul
- neg
- sub
- toConstant
- toField
- toFields
- toJSON
- toString
- check
- from
- fromField
- fromFieldUnchecked
- fromFields
- fromJSON
- fromObject
- fromUnsigned
- sizeInFields
- toAuxiliary
- toConstant
- toFields
- toInput
- toJSON
Constructors
constructor
• new Int64(magnitude
, sgn?
)
Parameters
Name | Type | Default value |
---|---|---|
magnitude | UInt64 | undefined |
sgn | Sign | Sign.one |
Overrides
Defined in
Properties
magnitude
• magnitude: UInt64
Implementation of
BalanceChange.magnitude
Defined in
sgn
• sgn: Sign
Implementation of
BalanceChange.sgn
Defined in
Accessors
minusOne
• Static
get
minusOne(): Int64
Static method to create a Int64 with value -1
.
Returns
Defined in
one
• Static
get
one(): Int64
Static method to create a Int64 with value 1
.
Returns
Defined in
zero
• Static
get
zero(): Int64
Static method to create a Int64 with value 0
.
Returns
Defined in
Methods
add
▸ add(y
): Int64
Addition with overflow checking.
Parameters
Name | Type |
---|---|
y | string | number | bigint | UInt64 | UInt32 | Int64 |
Returns
Defined in
assertEquals
▸ assertEquals(y
, message?
): void
Asserts that two values are equal.
Parameters
Name | Type |
---|---|
y | string | number | bigint | UInt64 | UInt32 | Int64 |
message? | string |
Returns
void
Overrides
Defined in
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
Name | Type |
---|---|
y | string | number | bigint | UInt64 | UInt32 | Int64 |
Returns
Defined in
equals
▸ equals(y
): Bool
Checks if two values are equal.
Parameters
Name | Type |
---|---|
y | string | number | bigint | UInt64 | UInt32 | Int64 |
Returns
Overrides
Defined in
isConstant
▸ isConstant(): boolean
Returns
boolean
Overrides
Defined in
isPositive
▸ isPositive(): Bool
Checks if the value is postive.
Returns
Defined in
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
Name | Type |
---|---|
y | string | number | bigint | UInt64 | UInt32 |
Returns
Defined in
mul
▸ mul(y
): Int64
Multiplication with overflow checking.
Parameters
Name | Type |
---|---|
y | string | number | bigint | UInt64 | UInt32 | Int64 |
Returns
Defined in
neg
▸ neg(): Int64
Negates the value.
Int64.from(5).neg()
will turn into Int64.from(-5)
Returns
Defined in
sub
▸ sub(y
): Int64
Subtraction with underflow checking.
Parameters
Name | Type |
---|---|
y | string | number | bigint | UInt64 | UInt32 | Int64 |
Returns
Defined in
toConstant
▸ toConstant(): Int64
Returns
Inherited from
Defined in
toField
▸ toField(): Field
Returns the Field value.
Returns
Defined in
toFields
▸ toFields(): Field
[]
Returns
Field
[]
Inherited from
Defined in
toJSON
▸ toJSON(): any
Returns
any
Inherited from
Defined in
toString
▸ toString(): string
Turns the Int64 into a string.
Returns
string
Defined in
check
▸ Static
check<T
>(this
, v
): void
Type parameters
Name | Type |
---|---|
T | extends AnyConstructor |
Parameters
Name | Type |
---|---|
this | T |
v | InstanceType <T > |
Returns
void
Inherited from
Defined in
from
▸ Static
from(x
): Int64
Creates a new Int64.
Check the range if the argument is a constant.
Parameters
Name | Type |
---|---|
x | string | number | bigint | Field | UInt64 | UInt32 | Int64 |
Returns
Defined in
fromField
▸ Static
fromField(x
): Int64
Static method to create a Int64 from a Field.
Parameters
Name | Type |
---|---|
x | Field |
Returns
Defined in
fromFieldUnchecked
▸ Static
Private
fromFieldUnchecked(x
): Int64
Creates a new Int64 from a Field.
Does check if the Field is within range.
Parameters
Name | Type |
---|---|
x | Field |
Returns
Defined in
fromFields
▸ Static
fromFields<T
>(this
, xs
): InstanceType
<T
>
Type parameters
Name | Type |
---|---|
T | extends AnyConstructor |
Parameters
Name | Type |
---|---|
this | T |
xs | Field [] |
Returns
InstanceType
<T
>
Inherited from
Defined in
fromJSON
▸ Static
fromJSON<T
>(this
, value
): InstanceType
<T
>
Type parameters
Name | Type |
---|---|
T | extends AnyConstructor |
Parameters
Name | Type |
---|---|
this | T |
value | any |
Returns
InstanceType
<T
>
Inherited from
Defined in
fromObject
▸ Static
fromObject<T
>(this
, value
): InstanceType
<T
>
Type parameters
Name | Type |
---|---|
T | extends AnyConstructor |
Parameters
Name | Type |
---|---|
this | T |
value | NonMethods <InstanceType <T >> |
Returns
InstanceType
<T
>
Inherited from
Defined in
fromUnsigned
▸ Static
fromUnsigned(x
): Int64
Creates a new Int64 from a Field.
Does not check if the Field is within range.
Parameters
Name | Type |
---|---|
x | UInt64 | UInt32 |
Returns
Defined in
sizeInFields
▸ Static
sizeInFields(): number
Returns
number
Inherited from
Defined in
toAuxiliary
▸ Static
toAuxiliary(): []
Returns
[]
Inherited from
Defined in
toConstant
▸ Static
toConstant<T
>(this
, t
): InstanceType
<T
>
Type parameters
Name | Type |
---|---|
T | extends AnyConstructor |
Parameters
Name | Type |
---|---|
this | T |
t | InstanceType <T > |
Returns
InstanceType
<T
>
Inherited from
Defined in
toFields
▸ Static
toFields<T
>(this
, v
): Field
[]
Type parameters
Name | Type |
---|---|
T | extends AnyConstructor |
Parameters
Name | Type |
---|---|
this | T |
v | InstanceType <T > |
Returns
Field
[]
Inherited from
Defined in
toInput
▸ Static
toInput<T
>(this
, v
): HashInput
Type parameters
Name | Type |
---|---|
T | extends AnyConstructor |
Parameters
Name | Type |
---|---|
this | T |
v | InstanceType <T > |
Returns
HashInput
Inherited from
Defined in
toJSON
▸ Static
toJSON<T
>(this
, v
): any
Type parameters
Name | Type |
---|---|
T | extends AnyConstructor |
Parameters
Name | Type |
---|---|
this | T |
v | InstanceType <T > |
Returns
any