QtBigInt
Loading...
Searching...
No Matches
bigint.cpp File Reference
#include "bigint.h"
#include <limits>
#include <cstring>
#include <cmath>
#include <cstdlib>
Include dependency graph for bigint.cpp:

Go to the source code of this file.

Macros

#define GMP_ABS(x)   ((x) >= 0 ? (x) : -(x))
 

Functions

BigInt operator+ (BigInt left, intMpz right)
 
BigInt operator+ (intMpz left, BigInt right)
 
BigInt operator+ (BigInt left, const BigInt &right)
 
BigInt operator+ (BigInt left, const std::string &right)
 
BigInt operator+ (const std::string &left, const BigInt &right)
 
BigInt & operator+= (BigInt &left, intMpz right)
 
BigInt & operator+= (BigInt &left, const BigInt &right)
 
BigInt & operator+= (BigInt &left, const std::string &right)
 
BigInt operator- (BigInt left, const BigInt &right)
 
BigInt operator- (BigInt left, intMpz right)
 
BigInt operator- (intMpz left, BigInt right)
 
BigInt operator- (BigInt val)
 
BigInt operator- (BigInt left, const std::string &right)
 
BigInt operator- (const std::string &left, const BigInt &right)
 
BigInt & operator-= (BigInt &left, const BigInt &right)
 
BigInt & operator-= (BigInt &left, const std::string &right)
 
BigInt & operator-= (BigInt &left, intMpz right)
 
BigInt operator/ (BigInt left, const BigInt &right)
 
BigInt operator/ (BigInt left, intMpz right)
 
BigInt operator/ (BigInt left, const std::string &right)
 
BigInt operator/ (intMpz left, BigInt right)
 
BigInt operator/ (const std::string &left, const BigInt &right)
 
BigInt & operator/= (BigInt &left, const BigInt &right)
 
BigInt & operator/= (BigInt &left, const std::string &right)
 
BigInt & operator/= (BigInt &left, intMpz right)
 
BigInt operator* (BigInt left, const BigInt &right)
 
BigInt operator* (BigInt left, intMpz right)
 
BigInt operator* (intMpz left, BigInt right)
 
BigInt operator* (const std::string &left, BigInt right)
 
BigInt operator* (BigInt left, const std::string &right)
 
BigInt & operator*= (BigInt &left, const BigInt &right)
 
BigInt & operator*= (BigInt &left, const std::string &right)
 
BigInt & operator*= (BigInt &left, intMpz right)
 
BigInt operator% (BigInt left, const BigInt &right)
 
BigInt operator% (BigInt left, intMpz right)
 
BigInt operator% (intMpz left, BigInt right)
 
BigInt operator% (BigInt left, const std::string &right)
 
BigInt operator% (const std::string &left, const BigInt &right)
 
BigInt & operator%= (BigInt &left, const BigInt &right)
 
BigInt & operator%= (BigInt &left, intMpz right)
 
BigInt & operator%= (BigInt &left, const std::string &right)
 
BigInt operator>> (BigInt left, int right)
 
BigInt operator<< (BigInt left, int right)
 
BigInt & operator>>= (BigInt &left, int right)
 
BigInt & operator<<= (BigInt &left, int right)
 
BigInt operator~ (BigInt left)
 
BigInt operator| (BigInt left, const BigInt &right)
 
BigInt operator| (const BigInt &left, intMpz right)
 
BigInt & operator|= (BigInt &left, const BigInt &right)
 
BigInt & operator|= (BigInt &left, intMpz right)
 
BigInt operator& (BigInt left, const BigInt &right)
 
BigInt operator& (const BigInt &left, intMpz right)
 
BigInt & operator&= (BigInt &left, const BigInt &right)
 
BigInt & operator&= (BigInt &left, intMpz right)
 
BigInt operator^ (BigInt left, const BigInt &right)
 
BigInt operator^ (const BigInt &left, intMpz right)
 
BigInt & operator^= (BigInt &left, const BigInt &right)
 
BigInt & operator^= (BigInt &left, intMpz right)
 
bool operator! (const BigInt &val)
 
bool operator== (const BigInt &left, const BigInt &right)
 
bool operator== (const BigInt &left, intMpz right)
 
bool operator== (const BigInt &left, const std::string &right)
 
bool operator== (intMpz left, const BigInt &right)
 
bool operator== (const std::string &left, const BigInt &right)
 
bool operator!= (const BigInt &left, const BigInt &right)
 
bool operator!= (const BigInt &left, intMpz right)
 
bool operator!= (const BigInt &left, const std::string &right)
 
bool operator!= (intMpz left, const BigInt &right)
 
bool operator!= (const std::string &left, const BigInt &right)
 
bool operator< (const BigInt &left, const BigInt &right)
 
bool operator< (const BigInt &left, intMpz right)
 
bool operator< (const BigInt &left, const std::string &right)
 
bool operator< (intMpz left, const BigInt &right)
 
bool operator< (const std::string &left, const BigInt &right)
 
bool operator> (const BigInt &left, const BigInt &right)
 
bool operator> (const BigInt &left, intMpz right)
 
bool operator> (const BigInt &left, const std::string &right)
 
bool operator> (intMpz left, const BigInt &right)
 
bool operator> (const std::string &left, const BigInt &right)
 
bool operator<= (const BigInt &left, const BigInt &right)
 
bool operator<= (const BigInt &left, intMpz right)
 
bool operator<= (const BigInt &left, const std::string &right)
 
bool operator<= (intMpz left, const BigInt &right)
 
bool operator<= (const std::string &left, const BigInt &right)
 
bool operator>= (const BigInt &left, const BigInt &right)
 
bool operator>= (const BigInt &left, intMpz right)
 
bool operator>= (const BigInt &left, const std::string &right)
 
bool operator>= (intMpz left, const BigInt &right)
 
bool operator>= (const std::string &left, const BigInt &right)
 

Macro Definition Documentation

◆ GMP_ABS

#define GMP_ABS (   x)    ((x) >= 0 ? (x) : -(x))

Definition at line 85 of file bigint.cpp.

Function Documentation

◆ operator!()

bool operator! ( const BigInt &  val)

Definition at line 493 of file bigint.cpp.

◆ operator!=() [1/5]

bool operator!= ( const BigInt &  left,
const BigInt &  right 
)

Definition at line 517 of file bigint.cpp.

◆ operator!=() [2/5]

bool operator!= ( const BigInt &  left,
const std::string &  right 
)

Definition at line 525 of file bigint.cpp.

◆ operator!=() [3/5]

bool operator!= ( const BigInt &  left,
intMpz  right 
)

Definition at line 521 of file bigint.cpp.

◆ operator!=() [4/5]

bool operator!= ( const std::string &  left,
const BigInt &  right 
)

Definition at line 533 of file bigint.cpp.

◆ operator!=() [5/5]

bool operator!= ( intMpz  left,
const BigInt &  right 
)

Definition at line 529 of file bigint.cpp.

◆ operator%() [1/5]

BigInt operator% ( BigInt  left,
const BigInt &  right 
)

Definition at line 320 of file bigint.cpp.

◆ operator%() [2/5]

BigInt operator% ( BigInt  left,
const std::string &  right 
)

Definition at line 334 of file bigint.cpp.

◆ operator%() [3/5]

BigInt operator% ( BigInt  left,
intMpz  right 
)

Definition at line 325 of file bigint.cpp.

◆ operator%() [4/5]

BigInt operator% ( const std::string &  left,
const BigInt &  right 
)

Definition at line 338 of file bigint.cpp.

◆ operator%() [5/5]

BigInt operator% ( intMpz  left,
BigInt  right 
)

Definition at line 330 of file bigint.cpp.

◆ operator%=() [1/3]

BigInt & operator%= ( BigInt &  left,
const BigInt &  right 
)

Definition at line 342 of file bigint.cpp.

◆ operator%=() [2/3]

BigInt & operator%= ( BigInt &  left,
const std::string &  right 
)

Definition at line 352 of file bigint.cpp.

◆ operator%=() [3/3]

BigInt & operator%= ( BigInt &  left,
intMpz  right 
)

Definition at line 347 of file bigint.cpp.

◆ operator&() [1/2]

BigInt operator& ( BigInt  left,
const BigInt &  right 
)

Definition at line 453 of file bigint.cpp.

◆ operator&() [2/2]

BigInt operator& ( const BigInt &  left,
intMpz  right 
)

Definition at line 458 of file bigint.cpp.

◆ operator&=() [1/2]

BigInt & operator&= ( BigInt &  left,
const BigInt &  right 
)

Definition at line 463 of file bigint.cpp.

◆ operator&=() [2/2]

BigInt & operator&= ( BigInt &  left,
intMpz  right 
)

Definition at line 468 of file bigint.cpp.

◆ operator*() [1/5]

BigInt operator* ( BigInt  left,
const BigInt &  right 
)

Definition at line 275 of file bigint.cpp.

◆ operator*() [2/5]

BigInt operator* ( BigInt  left,
const std::string &  right 
)

Definition at line 297 of file bigint.cpp.

◆ operator*() [3/5]

BigInt operator* ( BigInt  left,
intMpz  right 
)

Definition at line 280 of file bigint.cpp.

◆ operator*() [4/5]

BigInt operator* ( const std::string &  left,
BigInt  right 
)

Definition at line 293 of file bigint.cpp.

◆ operator*() [5/5]

BigInt operator* ( intMpz  left,
BigInt  right 
)

Definition at line 289 of file bigint.cpp.

◆ operator*=() [1/3]

BigInt & operator*= ( BigInt &  left,
const BigInt &  right 
)

Definition at line 301 of file bigint.cpp.

◆ operator*=() [2/3]

BigInt & operator*= ( BigInt &  left,
const std::string &  right 
)

Definition at line 306 of file bigint.cpp.

◆ operator*=() [3/3]

BigInt & operator*= ( BigInt &  left,
intMpz  right 
)

Definition at line 310 of file bigint.cpp.

◆ operator+() [1/5]

BigInt operator+ ( BigInt  left,
const BigInt &  right 
)

Definition at line 145 of file bigint.cpp.

◆ operator+() [2/5]

BigInt operator+ ( BigInt  left,
const std::string &  right 
)

Definition at line 150 of file bigint.cpp.

◆ operator+() [3/5]

BigInt operator+ ( BigInt  left,
intMpz  right 
)

Definition at line 132 of file bigint.cpp.

◆ operator+() [4/5]

BigInt operator+ ( const std::string &  left,
const BigInt &  right 
)

Definition at line 154 of file bigint.cpp.

◆ operator+() [5/5]

BigInt operator+ ( intMpz  left,
BigInt  right 
)

Definition at line 141 of file bigint.cpp.

◆ operator+=() [1/3]

BigInt & operator+= ( BigInt &  left,
const BigInt &  right 
)

Definition at line 166 of file bigint.cpp.

◆ operator+=() [2/3]

BigInt & operator+= ( BigInt &  left,
const std::string &  right 
)

Definition at line 171 of file bigint.cpp.

◆ operator+=() [3/3]

BigInt & operator+= ( BigInt &  left,
intMpz  right 
)

Definition at line 158 of file bigint.cpp.

◆ operator-() [1/6]

BigInt operator- ( BigInt  left,
const BigInt &  right 
)

Definition at line 177 of file bigint.cpp.

◆ operator-() [2/6]

BigInt operator- ( BigInt  left,
const std::string &  right 
)

Definition at line 203 of file bigint.cpp.

◆ operator-() [3/6]

BigInt operator- ( BigInt  left,
intMpz  right 
)

Definition at line 182 of file bigint.cpp.

◆ operator-() [4/6]

BigInt operator- ( BigInt  val)

Definition at line 198 of file bigint.cpp.

◆ operator-() [5/6]

BigInt operator- ( const std::string &  left,
const BigInt &  right 
)

Definition at line 207 of file bigint.cpp.

◆ operator-() [6/6]

BigInt operator- ( intMpz  left,
BigInt  right 
)

Definition at line 190 of file bigint.cpp.

◆ operator-=() [1/3]

BigInt & operator-= ( BigInt &  left,
const BigInt &  right 
)

Definition at line 211 of file bigint.cpp.

◆ operator-=() [2/3]

BigInt & operator-= ( BigInt &  left,
const std::string &  right 
)

Definition at line 216 of file bigint.cpp.

◆ operator-=() [3/3]

BigInt & operator-= ( BigInt &  left,
intMpz  right 
)

Definition at line 220 of file bigint.cpp.

◆ operator/() [1/5]

BigInt operator/ ( BigInt  left,
const BigInt &  right 
)

Definition at line 230 of file bigint.cpp.

◆ operator/() [2/5]

BigInt operator/ ( BigInt  left,
const std::string &  right 
)

Definition at line 244 of file bigint.cpp.

◆ operator/() [3/5]

BigInt operator/ ( BigInt  left,
intMpz  right 
)

Definition at line 235 of file bigint.cpp.

◆ operator/() [4/5]

BigInt operator/ ( const std::string &  left,
const BigInt &  right 
)

Definition at line 252 of file bigint.cpp.

◆ operator/() [5/5]

BigInt operator/ ( intMpz  left,
BigInt  right 
)

Definition at line 248 of file bigint.cpp.

◆ operator/=() [1/3]

BigInt & operator/= ( BigInt &  left,
const BigInt &  right 
)

Definition at line 256 of file bigint.cpp.

◆ operator/=() [2/3]

BigInt & operator/= ( BigInt &  left,
const std::string &  right 
)

Definition at line 261 of file bigint.cpp.

◆ operator/=() [3/3]

BigInt & operator/= ( BigInt &  left,
intMpz  right 
)

Definition at line 265 of file bigint.cpp.

◆ operator<() [1/5]

bool operator< ( const BigInt &  left,
const BigInt &  right 
)

Definition at line 537 of file bigint.cpp.

◆ operator<() [2/5]

bool operator< ( const BigInt &  left,
const std::string &  right 
)

Definition at line 545 of file bigint.cpp.

◆ operator<() [3/5]

bool operator< ( const BigInt &  left,
intMpz  right 
)

Definition at line 541 of file bigint.cpp.

◆ operator<() [4/5]

bool operator< ( const std::string &  left,
const BigInt &  right 
)

Definition at line 553 of file bigint.cpp.

◆ operator<() [5/5]

bool operator< ( intMpz  left,
const BigInt &  right 
)

Definition at line 549 of file bigint.cpp.

◆ operator<<()

BigInt operator<< ( BigInt  left,
int  right 
)

Definition at line 393 of file bigint.cpp.

◆ operator<<=()

BigInt & operator<<= ( BigInt &  left,
int  right 
)

Definition at line 417 of file bigint.cpp.

◆ operator<=() [1/5]

bool operator<= ( const BigInt &  left,
const BigInt &  right 
)

Definition at line 577 of file bigint.cpp.

◆ operator<=() [2/5]

bool operator<= ( const BigInt &  left,
const std::string &  right 
)

Definition at line 585 of file bigint.cpp.

◆ operator<=() [3/5]

bool operator<= ( const BigInt &  left,
intMpz  right 
)

Definition at line 581 of file bigint.cpp.

◆ operator<=() [4/5]

bool operator<= ( const std::string &  left,
const BigInt &  right 
)

Definition at line 593 of file bigint.cpp.

◆ operator<=() [5/5]

bool operator<= ( intMpz  left,
const BigInt &  right 
)

Definition at line 589 of file bigint.cpp.

◆ operator==() [1/5]

bool operator== ( const BigInt &  left,
const BigInt &  right 
)

Definition at line 497 of file bigint.cpp.

◆ operator==() [2/5]

bool operator== ( const BigInt &  left,
const std::string &  right 
)

Definition at line 505 of file bigint.cpp.

◆ operator==() [3/5]

bool operator== ( const BigInt &  left,
intMpz  right 
)

Definition at line 501 of file bigint.cpp.

◆ operator==() [4/5]

bool operator== ( const std::string &  left,
const BigInt &  right 
)

Definition at line 513 of file bigint.cpp.

◆ operator==() [5/5]

bool operator== ( intMpz  left,
const BigInt &  right 
)

Definition at line 509 of file bigint.cpp.

◆ operator>() [1/5]

bool operator> ( const BigInt &  left,
const BigInt &  right 
)

Definition at line 557 of file bigint.cpp.

◆ operator>() [2/5]

bool operator> ( const BigInt &  left,
const std::string &  right 
)

Definition at line 565 of file bigint.cpp.

◆ operator>() [3/5]

bool operator> ( const BigInt &  left,
intMpz  right 
)

Definition at line 561 of file bigint.cpp.

◆ operator>() [4/5]

bool operator> ( const std::string &  left,
const BigInt &  right 
)

Definition at line 573 of file bigint.cpp.

◆ operator>() [5/5]

bool operator> ( intMpz  left,
const BigInt &  right 
)

Definition at line 569 of file bigint.cpp.

◆ operator>=() [1/5]

bool operator>= ( const BigInt &  left,
const BigInt &  right 
)

Definition at line 597 of file bigint.cpp.

◆ operator>=() [2/5]

bool operator>= ( const BigInt &  left,
const std::string &  right 
)

Definition at line 605 of file bigint.cpp.

◆ operator>=() [3/5]

bool operator>= ( const BigInt &  left,
intMpz  right 
)

Definition at line 601 of file bigint.cpp.

◆ operator>=() [4/5]

bool operator>= ( const std::string &  left,
const BigInt &  right 
)

Definition at line 613 of file bigint.cpp.

◆ operator>=() [5/5]

bool operator>= ( intMpz  left,
const BigInt &  right 
)

Definition at line 609 of file bigint.cpp.

◆ operator>>()

BigInt operator>> ( BigInt  left,
int  right 
)

Definition at line 381 of file bigint.cpp.

◆ operator>>=()

BigInt & operator>>= ( BigInt &  left,
int  right 
)

Definition at line 405 of file bigint.cpp.

◆ operator^() [1/2]

BigInt operator^ ( BigInt  left,
const BigInt &  right 
)

Definition at line 472 of file bigint.cpp.

◆ operator^() [2/2]

BigInt operator^ ( const BigInt &  left,
intMpz  right 
)

Definition at line 477 of file bigint.cpp.

◆ operator^=() [1/2]

BigInt & operator^= ( BigInt &  left,
const BigInt &  right 
)

Definition at line 481 of file bigint.cpp.

◆ operator^=() [2/2]

BigInt & operator^= ( BigInt &  left,
intMpz  right 
)

Definition at line 486 of file bigint.cpp.

◆ operator|() [1/2]

BigInt operator| ( BigInt  left,
const BigInt &  right 
)

Definition at line 435 of file bigint.cpp.

◆ operator|() [2/2]

BigInt operator| ( const BigInt &  left,
intMpz  right 
)

Definition at line 440 of file bigint.cpp.

◆ operator|=() [1/2]

BigInt & operator|= ( BigInt &  left,
const BigInt &  right 
)

Definition at line 444 of file bigint.cpp.

◆ operator|=() [2/2]

BigInt & operator|= ( BigInt &  left,
intMpz  right 
)

Definition at line 449 of file bigint.cpp.

◆ operator~()

BigInt operator~ ( BigInt  left)

Definition at line 430 of file bigint.cpp.