A mutable arbitrary-precision integer.
This abstract type provides in-place modification of a BigInt
's value,
which can be more efficient for operations that involve many intermediate steps,
as it avoids repeated memory allocation.
Static methods
staticabs(this:MutableBigInt_):MutableBigInt
staticfromBigEndianBytesUnsigned(value:Bytes):MutableBigInt
Creates a MutableBigInt
from unsigned, big-endian bytes.
Parameters:
value | The |
---|
Returns:
A new MutableBigInt
instance.
staticfromLittleEndianBytesUnsigned(value:Bytes):MutableBigInt
Creates a MutableBigInt
from unsigned, little-endian bytes.
Parameters:
value | The |
---|
Returns:
A new MutableBigInt
instance.
staticgcd(this:MutableBigInt_, b:BigInt):MutableBigInt
Calculates the GCD of this and another BigInt
.
Parameters:
b | The other |
---|
Returns:
A new MutableBigInt
holding the result.
staticinlinegetBit(this:MutableBigInt_, index:Int):Int
Gets the value of a single bit at the specified index.
Parameters:
index | The index of the bit to get. |
---|
Returns:
1 if the bit is set, 0 otherwise.
staticgetLowestSetBit(this:MutableBigInt_):Int
Gets the index of the lowest-set (rightmost) '1' bit.
Returns:
The bit index, or -1 if zero.
staticinlineisNegative(this:MutableBigInt_):Bool
Checks if this MutableBigInt
is a negative number.
Returns:
staticisProbablePrime(this:MutableBigInt_, tolerance:UInt):Bool
Tests if this number is probably prime.
Parameters:
tolerance | Certainty level for the Miller-Rabin test. |
---|
Returns:
true
if probably prime.
staticmodPow(this:MutableBigInt_, exponent:BigInt, modulus:BigInt):MutableBigInt
Calculates (this ^ exponent) mod modulus
.
Parameters:
exponent | The exponent. |
---|---|
modulus | The modulus. |
Returns:
A new MutableBigInt
holding the result.
staticpow(this:MutableBigInt_, exponent:UInt):MutableBigInt
Raises this number to the power of exponent
.
Parameters:
exponent | The non-negative exponent. |
---|
Returns:
A new MutableBigInt
holding the result.
staticinlinesetFromBigEndianBytesUnsigned(this:MutableBigInt_, value:Bytes, offset:Int = 0, length:Int = 0):Void
staticinlinesetFromInt(this:MutableBigInt_, value:Int):Void
staticinlinesetFromLittleEndianBytesUnsigned(this:MutableBigInt_, value:Bytes, offset:Int = 0, length:Int = 0):Void
staticinlinesetFromUnsignedInts(this:MutableBigInt_, value:Vector<Int>, length:Int = 0):Void
staticinlinesetFromVector(this:MutableBigInt_, source:Vector<Int32>, sourcePosition:Int, length:Int):Void
staticinlinetoInts(this:MutableBigInt_, output:Vector<Int>):Int
Converts this MutableBigInt
to a Vector
of Int
s.
Parameters:
output | The vector to write the integer words into. |
---|
Returns:
The number of words written.
staticinlinetoString(this:MutableBigInt_, radix:Int = 10):String
Returns the string representation of this MutableBigInt
in the specified base.
Parameters:
radix | The base for the conversion (e.g., 10 for decimal). |
---|
Returns:
The string representation of the number.