BigIntegerArithmetic

Interface defining big integer operations

Created by Ugljesa Jovanovic ugljesa.jovanovic@ionspin.com on 10-Mar-2019

Properties

Link copied to clipboard
Link copied to clipboard
abstract val basePowerOfTwo: Int
Link copied to clipboard
abstract val ONE: ULongArray
Link copied to clipboard
abstract val TEN: ULongArray
Link copied to clipboard
abstract val TWO: ULongArray
Link copied to clipboard
abstract val ZERO: ULongArray

Functions

Link copied to clipboard
abstract fun add(first: ULongArray, second: ULongArray): ULongArray

Adds two big integers

Link copied to clipboard
abstract fun and(operand: ULongArray, mask: ULongArray): ULongArray
Link copied to clipboard
abstract fun bitAt(operand: ULongArray, position: Long): Boolean
Link copied to clipboard
abstract fun bitLength(value: ULongArray): Int

Number of bits needed to represent this number

Link copied to clipboard
abstract fun compare(first: ULongArray, second: ULongArray): Int

Compares two numbers

Link copied to clipboard
abstract fun divide(first: ULongArray, second: ULongArray): Pair<ULongArray, ULongArray>

Divide two big integers

Link copied to clipboard
abstract fun fromByte(byte: Byte): ULongArray
Link copied to clipboard
abstract fun fromByteArray(source: ByteArray): ULongArray
Link copied to clipboard
abstract fun fromInt(int: Int): ULongArray
Link copied to clipboard
abstract fun fromLong(long: Long): ULongArray
Link copied to clipboard
abstract fun fromShort(short: Short): ULongArray
Link copied to clipboard
abstract fun fromUByte(uByte: UByte): ULongArray
Link copied to clipboard
abstract fun fromUByteArray(source: UByteArray): ULongArray
Link copied to clipboard
abstract fun fromUInt(uInt: UInt): ULongArray
Link copied to clipboard
abstract fun fromULong(uLong: ULong): ULongArray
Link copied to clipboard
abstract fun fromUShort(uShort: UShort): ULongArray
Link copied to clipboard
abstract fun gcd(first: ULongArray, second: ULongArray): ULongArray
Link copied to clipboard
abstract fun multiply(first: ULongArray, second: ULongArray): ULongArray

Multiplies two big integers

Link copied to clipboard
abstract fun not(operand: ULongArray): ULongArray
Link copied to clipboard
abstract fun numberOfDecimalDigits(operand: ULongArray): Long
Link copied to clipboard
abstract fun numberOfLeadingZerosInAWord(value: ULong): Int

Returns the number of leading zeros in a word

Link copied to clipboard
abstract fun or(operand: ULongArray, mask: ULongArray): ULongArray
Link copied to clipboard
abstract fun parseForBase(number: String, base: Int): ULongArray

Parse a string in a specific base into a big integer

Link copied to clipboard
abstract fun pow(base: ULongArray, exponent: Long): ULongArray

Exponentiation function

Link copied to clipboard
abstract fun reciprocal(operand: ULongArray): Pair<ULongArray, ULongArray>

Returns a integer reciprocal of this number such that 0 <= base ^ word - operand * reciprocal <= operand, and remainder such that 0 < reciprocal < operand

Link copied to clipboard
abstract fun setBitAt(operand: ULongArray, position: Long, bit: Boolean): ULongArray
Link copied to clipboard
abstract fun shiftLeft(operand: ULongArray, places: Int): ULongArray

Arithmetic shift left. Shifts the number to the left, by required places of bits, creating new words if necessary

Link copied to clipboard
abstract fun shiftRight(operand: ULongArray, places: Int): ULongArray

Arithmetic shift right. Shifts the number to the right, by required places of bits, removing words that no longer relevant

Link copied to clipboard
abstract fun sqrt(operand: ULongArray): Pair<ULongArray, ULongArray>
Link copied to clipboard
abstract fun subtract(first: ULongArray, second: ULongArray): ULongArray

Subtracts two big integers

Link copied to clipboard
abstract fun toByteArray(operand: ULongArray): ByteArray
Link copied to clipboard
abstract fun toString(operand: ULongArray, base: Int): String

return a string representation of big integer in a specific number base

Link copied to clipboard
abstract fun toUByteArray(operand: ULongArray): UByteArray
Link copied to clipboard
abstract fun trailingZeroBits(value: ULongArray): Int

Number of consecutive zeros count from the right in binary representation

Link copied to clipboard
abstract fun xor(operand: ULongArray, mask: ULongArray): ULongArray