|
| BigInteger () |
| Creates an empty BigInteger.
|
|
| BigInteger (uint32 value) |
| Creates a BigInteger containing an integer value in its low bits.
|
|
| BigInteger (int32 value) |
| Creates a BigInteger containing an integer value in its low bits.
|
|
| BigInteger (int64 value) |
| Creates a BigInteger containing an integer value in its low bits.
|
|
| BigInteger (const BigInteger &) |
| Creates a copy of another BigInteger.
|
|
| BigInteger (BigInteger &&) noexcept |
| Move constructor.
|
|
BigInteger & | operator= (BigInteger &&) noexcept |
| Move assignment operator.
|
|
| ~BigInteger () |
| Destructor.
|
|
BigInteger & | operator= (const BigInteger &) |
| Copies another BigInteger onto this one.
|
|
void | swapWith (BigInteger &) noexcept |
| Swaps the internal contents of this with another object.
|
|
bool | operator[] (int bit) const noexcept |
| Returns the value of a specified bit in the number.
|
|
bool | isZero () const noexcept |
| Returns true if no bits are set.
|
|
bool | isOne () const noexcept |
| Returns true if the value is 1.
|
|
int | toInteger () const noexcept |
| Attempts to get the lowest 32 bits of the value as an integer.
|
|
int64 | toInt64 () const noexcept |
| Attempts to get the lowest 64 bits of the value as an integer.
|
|
BigInteger & | clear () noexcept |
| Resets the value to 0.
|
|
BigInteger & | clearBit (int bitNumber) noexcept |
| Clears a particular bit in the number.
|
|
BigInteger & | setBit (int bitNumber) |
| Sets a specified bit to 1.
|
|
BigInteger & | setBit (int bitNumber, bool shouldBeSet) |
| Sets or clears a specified bit.
|
|
BigInteger & | setRange (int startBit, int numBits, bool shouldBeSet) |
| Sets a range of bits to be either on or off.
|
|
BigInteger & | insertBit (int bitNumber, bool shouldBeSet) |
| Inserts a bit an a given position, shifting up any bits above it.
|
|
BigInteger | getBitRange (int startBit, int numBits) const |
| Returns a range of bits as a new BigInteger.
|
|
uint32 | getBitRangeAsInt (int startBit, int numBits) const noexcept |
| Returns a range of bits as an integer value.
|
|
BigInteger & | setBitRangeAsInt (int startBit, int numBits, uint32 valueToSet) |
| Sets a range of bits to an integer value.
|
|
BigInteger & | shiftBits (int howManyBitsLeft, int startBit) |
| Shifts a section of bits left or right.
|
|
int | countNumberOfSetBits () const noexcept |
| Returns the total number of set bits in the value.
|
|
int | findNextSetBit (int startIndex) const noexcept |
| Looks for the index of the next set bit after a given starting point.
|
|
int | findNextClearBit (int startIndex) const noexcept |
| Looks for the index of the next clear bit after a given starting point.
|
|
int | getHighestBit () const noexcept |
| Returns the index of the highest set bit in the number.
|
|
bool | isNegative () const noexcept |
| Returns true if the value is less than zero.
|
|
void | setNegative (bool shouldBeNegative) noexcept |
| Changes the sign of the number to be positive or negative.
|
|
void | negate () noexcept |
| Inverts the sign of the number.
|
|
BigInteger & | operator+= (const BigInteger &) |
|
BigInteger & | operator-= (const BigInteger &) |
|
BigInteger & | operator*= (const BigInteger &) |
|
BigInteger & | operator/= (const BigInteger &) |
|
BigInteger & | operator|= (const BigInteger &) |
|
BigInteger & | operator&= (const BigInteger &) |
|
BigInteger & | operator^= (const BigInteger &) |
|
BigInteger & | operator%= (const BigInteger &) |
|
BigInteger & | operator<<= (int numBitsToShift) |
|
BigInteger & | operator>>= (int numBitsToShift) |
|
BigInteger & | operator++ () |
|
BigInteger & | operator-- () |
|
BigInteger | operator++ (int) |
|
BigInteger | operator-- (int) |
|
BigInteger | operator- () const |
|
BigInteger | operator+ (const BigInteger &) const |
|
BigInteger | operator- (const BigInteger &) const |
|
BigInteger | operator* (const BigInteger &) const |
|
BigInteger | operator/ (const BigInteger &) const |
|
BigInteger | operator| (const BigInteger &) const |
|
BigInteger | operator& (const BigInteger &) const |
|
BigInteger | operator^ (const BigInteger &) const |
|
BigInteger | operator% (const BigInteger &) const |
|
BigInteger | operator<< (int numBitsToShift) const |
|
BigInteger | operator>> (int numBitsToShift) const |
|
bool | operator== (const BigInteger &) const noexcept |
|
bool | operator!= (const BigInteger &) const noexcept |
|
bool | operator< (const BigInteger &) const noexcept |
|
bool | operator<= (const BigInteger &) const noexcept |
|
bool | operator> (const BigInteger &) const noexcept |
|
bool | operator>= (const BigInteger &) const noexcept |
|
int | compare (const BigInteger &other) const noexcept |
| Does a signed comparison of two BigIntegers.
|
|
int | compareAbsolute (const BigInteger &other) const noexcept |
| Compares the magnitudes of two BigIntegers, ignoring their signs.
|
|
void | divideBy (const BigInteger &divisor, BigInteger &remainder) |
| Divides this value by another one and returns the remainder.
|
|
BigInteger | findGreatestCommonDivisor (BigInteger other) const |
| Returns the largest value that will divide both this value and the argument.
|
|
void | exponentModulo (const BigInteger &exponent, const BigInteger &modulus) |
| Performs a combined exponent and modulo operation.
|
|
void | inverseModulo (const BigInteger &modulus) |
| Performs an inverse modulo on the value.
|
|
void | montgomeryMultiplication (const BigInteger &other, const BigInteger &modulus, const BigInteger &modulusp, int k) |
| Performs the Montgomery Multiplication with modulo.
|
|
void | extendedEuclidean (const BigInteger &a, const BigInteger &b, BigInteger &xOut, BigInteger &yOut) |
| Performs the Extended Euclidean algorithm.
|
|
String | toString (int base, int minimumNumCharacters=1) const |
| Converts the number to a string.
|
|
void | parseString (StringRef text, int base) |
| Reads the numeric value from a string.
|
|
MemoryBlock | toMemoryBlock () const |
| Turns the number into a block of binary data.
|
|
void | loadFromMemoryBlock (const MemoryBlock &data) |
| Converts a block of raw data into a number.
|
|
An arbitrarily large integer class.
A BigInteger can be used in a similar way to a normal integer, but has no size limit (except for memory and performance constraints).
Negative values are possible, but the value isn't stored as 2s-complement, so be careful if you use negative values and look at the values of individual bits.