Int64

The convention is to name the module alias after the file name it is defined in:

import Int64 "mo:base/Int64";

On this page

Constants

Value minimumValue
Value maximumValue

Conversion

Function toInt
Function toText
Function fromInt
Function fromIntWrap
Function fromNat64
Function toNat64

Comparison

Function min
Function max
Function equal
Function notEqual
Function less
Function lessOrEqual
Function greater
Function greaterOrEqual
Function compare

Numerical Operations

Function abs
Function neg
Function add
Function sub
Function mul
Function div
Function rem
Function pow

Bitwise Operators

Function bitnot
Function bitand
Function bitor
Function bitxor
Function bitshiftLeft
Function bitshiftRight
Function bitrotLeft
Function bitrotRight
Function bittest
Function bitset
Function bitclear
Function bitflip
Function bitcountNonZero
Function bitcountLeadingZero
Function bitcountTrailingZero

Wrapping Operations

Function addWrap
Function subWrap
Function mulWrap
Function powWrap

minimumValue

let minimumValue : Int64 = -9_223_372_036_854_775_808;

maximumValue

let maximumValue : Int64 = 9_223_372_036_854_775_807;

Int64.toInt

 func toInt(i : Int64) : Int

The function toInt takes one Int64 value and returns an Int value.

import Int64 "mo:base/Int64";

let a : Int64 = -92233;

Int64.toInt(a);

Int64.toText

 func toText(i : Int64) : Text

The function toText takes one Int64 value and returns a Text value.

import Int64 "mo:base/Int64";

let b : Int64 = -92233;

Int64.toText(b);

Int64.fromInt

 func fromInt(i : Int) : Int64

The function fromInt takes one Int value and returns an Int64 value.

import Int64 "mo:base/Int64";

let integer : Int = -92233;

Int64.fromInt(integer);

Int64.fromIntWrap

 func fromIntWrap(i : Int) : Int64

The function fromIntWrap takes one Int value and returns an Int64 value.

import Int64 "mo:base/Int64";

let integer : Int = 18_446_744_073_709_551_615;

Int64.fromIntWrap(integer);

Int64.fromNat64

 func fromNat64(i : Nat64) : Int64

The function fromNat64 takes one Nat64 value and returns an Int64 value.

import Int64 "mo:base/Int64";

let nat64 : Nat64 = 18_446_744_073_709_551_615;

Int64.fromNat64(nat64);

Int64.toNat64

 func toNat64(i : Int64) : Nat64

The function toNat64 takes one Int64 value and returns an Nat64 value.

import Int64 "mo:base/Int64";

let int64 : Int64 = -9551616;

Int64.toNat64(int64);

Int64.min

func min(x : Int64, y : Int64) : Int64

The function min takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 2000;
let y : Int64 = 1001;

Int64.min(x, y);

Int64.max

func max(x : Int64, y : Int64) : Int64

The function max takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 2000;
let y : Int64 = 2001;

Int64.max(x, y);

Int64.equal

func equal(x : Int64, y : Int64) : Bool

The function equal takes two Int64 value and returns a Bool value.

import Int64 "mo:base/Int64";

let x : Int64 = 1000;
let y : Int64 = 100;

Int64.equal(x, y);

Int64.notEqual

func notEqual(x : Int64, y : Int64) : Bool

The function notEqual takes two Int64 value and returns a Bool value.

import Int64 "mo:base/Int64";

let x : Int64 = 1000;
let y : Int64 = 1001;

Int64.notEqual(x, y);

Int64.less

func less(x : Int64, y : Int64) : Bool

The function less takes two Int64 value and returns a Bool value.

import Int64 "mo:base/Int64";

let x : Int64 = 2000;
let y : Int64 = 2500;

Int64.less(x, y);

Int64.lessOrEqual

func lessOrEqual(x : Int64, y : Int64) : Bool

The function lessOrEqual takes two Int64 value and returns a Bool value.

import Int64 "mo:base/Int64";

let x : Int64 = 2000;
let y : Int64 = 2500;

Int64.lessOrEqual(x, y);

Int64.greater

func greater(x : Int64, y : Int64) : Bool

The function greater takes two Int64 value and returns a Bool value.

import Int64 "mo:base/Int64";

let x : Int64 = 2000;
let y : Int64 = 1000;

Int64.greater(x, y);

Int64.greaterOrEqual

func greaterOrEqual(x : Int64, y : Int64) : Bool

The function greaterOrEqual takes two Int64 value and returns a Bool value.

import Int64 "mo:base/Int64";

let x : Int64 = 2000;
let y : Int64 = 1000;

Int64.greaterOrEqual(x, y);

Int64.compare

func compare(x : Int64, y : Int64) : Bool

The function compare takes two Int64 value and returns an Order variant value.

import Int64 "mo:base/Int64";

let x : Int64 = 10000;
let y : Int64 = 9999;

Int64.compare(x, y);

Int64.abs

func abs(x : Int64) : Int64

The function abs takes one Int64 value and returns a Int64 value.

import Int8 "mo:base/Int8";

let x : Int8 = -40;

Int8.abs(x);

Int64.neg

func neg(x : Int64) : Int64

The function neg takes one Int64 value and returns a Int64 value.

import Int8 "mo:base/Int8";

let x : Int8 = -50;

Int8.neg(x);

Int64.add

func add(x : Int64, y : Int64) : Int64

The function add takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 2000;
let y : Int64 = 1200;

Int64.add(x, y);

Int64.sub

func sub(x : Int64, y : Int64) : Int64

The function sub takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 4000;
let y : Int64 = 3999;

Int64.sub(x, y);

Int64.mul

func mul(x : Int64, y : Int64) : Int64

The function mul takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 200;
let y : Int64 = 50;

Int64.mul(x, y);

Int64.div

func div(x : Int64, y : Int64) : Int64

The function div takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 5000;
let y : Int64 = 500;

Int64.div(x, y);

Int64.rem

func rem(x : Int64, y : Int64) : Int64

The function rem takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 4000;
let y : Int64 = 1200;

Int64.rem(x, y);

Int64.pow

func pow(x : Int64, y : Int64) : Int64

The function pow takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 10;
let y : Int64 = 5;

Int64.pow(x, y);

Int64.bitnot

func bitnot(x : Int64) : Int64

The function bitnot takes one Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 9_223_372_036_854_775_807;

Int64.bitnot(x)

Int64.bitand

func bitand(x : Int64, y : Int64) : Int64

The function bitand takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 4294967295;
let y : Int64 = 255;

Int64.bitand(x, y)

Int64.bitor

func bitor(x : Int64, y : Int64) : Int64

The function bitor takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 240;
let y : Int64 = 15;

Int64.bitor(x, y)

Int64.bitxor

func bitxor(x : Int64, y : Int64) : Int64

The function bitxor takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 255;
let y : Int64 = 240;

Int64.bitxor(x, y)

Int64.bitshiftLeft

func bitshiftLeft(x : Int64, y : Int64) : Int64

The function bitshiftLeft takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 15;
let y : Int64 = 4;

Int64.bitshiftLeft(x, y)

Int64.bitshiftRight

func bitshiftRight(x : Int64, y : Int64) : Int64

The function bitshiftRight takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 240;
let y : Int64 = 4;

Int64.bitshiftRight(x, y)

Int64.bitrotLeft

func bitrotLeft(x : Int64, y : Int64) : Int64

The function bitrotLeft takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 9_223_372_036_854_775_807;
let y : Int64 = 1;

Int64.bitrotLeft(x, y)

Int64.bitrotRight

func bitrotRight(x : Int64, y : Int64) : Int64

The function bitrotRight takes two Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 9_223_372_036_854_775_807;
let y : Int64 = 1;

Int64.bitrotRight(x, y)

Int64.bittest

func bittest(x : Int64, p : Nat) : Bool

The function bittest takes one Int64 and one Nat value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 255;
let p : Nat = 7;

Int64.bittest(x, p)

Int64.bitset

func bitset(x : Int64, p : Nat) : Bool

The function bitset takes one Int64 and one Nat value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 127;
let p : Nat = 7;

Int64.bitset(x, p)

Int64.bitclear

func bitclear(x : Int64, p : Nat) : Bool

The function bitclear takes one Int64 and one Nat value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 255;
let p : Nat = 7;

Int64.bitclear(x, p)

Int64.bitflip

func bitflip(x : Int64, p : Nat) : Bool

The function bitflip takes one Int64 and one Nat value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 255;
let p : Nat = 7;

Int64.bitflip(x, p)

Int64.bitcountNonZero

let bitcountNonZero : (x : Int64) -> Int64

The function bitcountNonZero takes one Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 255;

Int64.bitcountNonZero(x)

Int64.bitcountLeadingZero

let bitcountLeadingZero : (x : Int64) -> Int64

The function bitcountLeadingZero takes one Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 255;

Int64.bitcountLeadingZero(x)

Int64.bitcountTrailingZero

let bitcountTrailingZero : (x : Int64) -> Int64

The function bitcountTrailingZero takes one Int64 value and returns a Int64 value.

import Int64 "mo:base/Int64";

let x : Int64 = 128;

Int64.bitcountTrailingZero(x)

Int64.addWrap

func addWrap(x : Int64, y : Int64) : Int64

The function addWrap takes two Int64 value and returns a Int64 value.It is equivalent to the +% Bitwise operators.

import Int64 "mo:base/Int64";

let x : Int64 = 9_223_372_036_854_775_807;
let y : Int64 = 1;

Int64.addWrap(x, y)

Int64.subWrap

func subWrap(x : Int64, y : Int64) : Int64

The function subWrap takes two Int64 value and returns a Int64 value.It is equivalent to the -% Bitwise operators.

import Int64 "mo:base/Int64";

let x : Int64 = -9_223_372_036_854_775_808;
let y : Int64 = 1;

Int64.subWrap(x, y)

Int64.mulWrap

func mulWrap(x : Int64, y : Int64) : Int64

The function mulWrap takes two Int64 value and returns a Int64 value.It is equivalent to the *% Bitwise operators.

import Int64 "mo:base/Int64";

let x : Int64 = 9_223_372_036_854_775_807;
let y : Int64 = 2;

Int64.mulWrap(x, y)

Int64.powWrap

func powWrap(x : Int64, y : Int64) : Int64

The function powWrap takes two Int64 value and returns a Int64 value.It is equivalent to the **% Bitwise operators.

import Int64 "mo:base/Int64";

let x : Int64 = 4294967296;
let y : Int64 = 2;

Int64.powWrap(x, y)