QtBigInt
Loading...
Searching...
No Matches
bigint.cpp File Reference
#include "bigint.h"
#include <limits>
#include <cstring>
#include <cmath>
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)
 
BigIntoperator+= (BigInt &left, intMpz right)
 
BigIntoperator+= (BigInt &left, const BigInt &right)
 
BigIntoperator+= (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)
 
BigIntoperator-= (BigInt &left, const BigInt &right)
 
BigIntoperator-= (BigInt &left, const std::string &right)
 
BigIntoperator-= (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)
 
BigIntoperator/= (BigInt &left, const BigInt &right)
 
BigIntoperator/= (BigInt &left, const std::string &right)
 
BigIntoperator/= (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)
 
BigIntoperator*= (BigInt &left, const BigInt &right)
 
BigIntoperator*= (BigInt &left, const std::string &right)
 
BigIntoperator*= (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)
 
BigIntoperator%= (BigInt &left, const BigInt &right)
 
BigIntoperator%= (BigInt &left, intMpz right)
 
BigIntoperator%= (BigInt &left, const std::string &right)
 
BigInt operator>> (BigInt left, int right)
 
BigInt operator<< (BigInt left, int right)
 
BigIntoperator>>= (BigInt &left, int right)
 
BigIntoperator<<= (BigInt &left, int right)
 
BigInt operator~ (BigInt left)
 
BigInt operator| (BigInt left, const BigInt &right)
 
BigInt operator| (const BigInt &left, intMpz right)
 
BigIntoperator|= (BigInt &left, const BigInt &right)
 
BigIntoperator|= (BigInt &left, intMpz right)
 
BigInt operator& (BigInt left, const BigInt &right)
 
BigInt operator& (const BigInt &left, intMpz right)
 
BigIntoperator&= (BigInt &left, const BigInt &right)
 
BigIntoperator&= (BigInt &left, intMpz right)
 
BigInt operator^ (BigInt left, const BigInt &right)
 
BigInt operator^ (const BigInt &left, intMpz right)
 
BigIntoperator^= (BigInt &left, const BigInt &right)
 
BigIntoperator^= (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 82 of file bigint.cpp.

Function Documentation

◆ operator!()

bool operator! ( const BigInt val)

Definition at line 490 of file bigint.cpp.

◆ operator!=() [1/5]

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

Definition at line 514 of file bigint.cpp.

◆ operator!=() [2/5]

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

Definition at line 522 of file bigint.cpp.

◆ operator!=() [3/5]

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

Definition at line 518 of file bigint.cpp.

◆ operator!=() [4/5]

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

Definition at line 530 of file bigint.cpp.

◆ operator!=() [5/5]

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

Definition at line 526 of file bigint.cpp.

◆ operator%() [1/5]

BigInt operator% ( BigInt  left,
const BigInt right 
)

Definition at line 317 of file bigint.cpp.

◆ operator%() [2/5]

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

Definition at line 331 of file bigint.cpp.

◆ operator%() [3/5]

BigInt operator% ( BigInt  left,
intMpz  right 
)

Definition at line 322 of file bigint.cpp.

◆ operator%() [4/5]

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

Definition at line 335 of file bigint.cpp.

◆ operator%() [5/5]

BigInt operator% ( intMpz  left,
BigInt  right 
)

Definition at line 327 of file bigint.cpp.

◆ operator%=() [1/3]

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

Definition at line 339 of file bigint.cpp.

◆ operator%=() [2/3]

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

Definition at line 349 of file bigint.cpp.

◆ operator%=() [3/3]

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

Definition at line 344 of file bigint.cpp.

◆ operator&() [1/2]

BigInt operator& ( BigInt  left,
const BigInt right 
)

Definition at line 450 of file bigint.cpp.

◆ operator&() [2/2]

BigInt operator& ( const BigInt left,
intMpz  right 
)

Definition at line 455 of file bigint.cpp.

◆ operator&=() [1/2]

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

Definition at line 460 of file bigint.cpp.

◆ operator&=() [2/2]

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

Definition at line 465 of file bigint.cpp.

◆ operator*() [1/5]

BigInt operator* ( BigInt  left,
const BigInt right 
)

Definition at line 272 of file bigint.cpp.

◆ operator*() [2/5]

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

Definition at line 294 of file bigint.cpp.

◆ operator*() [3/5]

BigInt operator* ( BigInt  left,
intMpz  right 
)

Definition at line 277 of file bigint.cpp.

◆ operator*() [4/5]

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

Definition at line 290 of file bigint.cpp.

◆ operator*() [5/5]

BigInt operator* ( intMpz  left,
BigInt  right 
)

Definition at line 286 of file bigint.cpp.

◆ operator*=() [1/3]

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

Definition at line 298 of file bigint.cpp.

◆ operator*=() [2/3]

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

Definition at line 303 of file bigint.cpp.

◆ operator*=() [3/3]

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

Definition at line 307 of file bigint.cpp.

◆ operator+() [1/5]

BigInt operator+ ( BigInt  left,
const BigInt right 
)

Definition at line 142 of file bigint.cpp.

◆ operator+() [2/5]

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

Definition at line 147 of file bigint.cpp.

◆ operator+() [3/5]

BigInt operator+ ( BigInt  left,
intMpz  right 
)

Definition at line 129 of file bigint.cpp.

◆ operator+() [4/5]

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

Definition at line 151 of file bigint.cpp.

◆ operator+() [5/5]

BigInt operator+ ( intMpz  left,
BigInt  right 
)

Definition at line 138 of file bigint.cpp.

◆ operator+=() [1/3]

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

Definition at line 163 of file bigint.cpp.

◆ operator+=() [2/3]

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

Definition at line 168 of file bigint.cpp.

◆ operator+=() [3/3]

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

Definition at line 155 of file bigint.cpp.

◆ operator-() [1/6]

BigInt operator- ( BigInt  left,
const BigInt right 
)

Definition at line 174 of file bigint.cpp.

◆ operator-() [2/6]

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

Definition at line 200 of file bigint.cpp.

◆ operator-() [3/6]

BigInt operator- ( BigInt  left,
intMpz  right 
)

Definition at line 179 of file bigint.cpp.

◆ operator-() [4/6]

BigInt operator- ( BigInt  val)

Definition at line 195 of file bigint.cpp.

◆ operator-() [5/6]

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

Definition at line 204 of file bigint.cpp.

◆ operator-() [6/6]

BigInt operator- ( intMpz  left,
BigInt  right 
)

Definition at line 187 of file bigint.cpp.

◆ operator-=() [1/3]

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

Definition at line 208 of file bigint.cpp.

◆ operator-=() [2/3]

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

Definition at line 213 of file bigint.cpp.

◆ operator-=() [3/3]

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

Definition at line 217 of file bigint.cpp.

◆ operator/() [1/5]

BigInt operator/ ( BigInt  left,
const BigInt right 
)

Definition at line 227 of file bigint.cpp.

◆ operator/() [2/5]

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

Definition at line 241 of file bigint.cpp.

◆ operator/() [3/5]

BigInt operator/ ( BigInt  left,
intMpz  right 
)

Definition at line 232 of file bigint.cpp.

◆ operator/() [4/5]

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

Definition at line 249 of file bigint.cpp.

◆ operator/() [5/5]

BigInt operator/ ( intMpz  left,
BigInt  right 
)

Definition at line 245 of file bigint.cpp.

◆ operator/=() [1/3]

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

Definition at line 253 of file bigint.cpp.

◆ operator/=() [2/3]

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

Definition at line 258 of file bigint.cpp.

◆ operator/=() [3/3]

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

Definition at line 262 of file bigint.cpp.

◆ operator<() [1/5]

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

Definition at line 534 of file bigint.cpp.

◆ operator<() [2/5]

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

Definition at line 542 of file bigint.cpp.

◆ operator<() [3/5]

bool operator< ( const BigInt left,
intMpz  right 
)

Definition at line 538 of file bigint.cpp.

◆ operator<() [4/5]

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

Definition at line 550 of file bigint.cpp.

◆ operator<() [5/5]

bool operator< ( intMpz  left,
const BigInt right 
)

Definition at line 546 of file bigint.cpp.

◆ operator<<()

BigInt operator<< ( BigInt  left,
int  right 
)

Definition at line 390 of file bigint.cpp.

◆ operator<<=()

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

Definition at line 414 of file bigint.cpp.

◆ operator<=() [1/5]

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

Definition at line 574 of file bigint.cpp.

◆ operator<=() [2/5]

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

Definition at line 582 of file bigint.cpp.

◆ operator<=() [3/5]

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

Definition at line 578 of file bigint.cpp.

◆ operator<=() [4/5]

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

Definition at line 590 of file bigint.cpp.

◆ operator<=() [5/5]

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

Definition at line 586 of file bigint.cpp.

◆ operator==() [1/5]

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

Definition at line 494 of file bigint.cpp.

◆ operator==() [2/5]

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

Definition at line 502 of file bigint.cpp.

◆ operator==() [3/5]

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

Definition at line 498 of file bigint.cpp.

◆ operator==() [4/5]

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

Definition at line 510 of file bigint.cpp.

◆ operator==() [5/5]

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

Definition at line 506 of file bigint.cpp.

◆ operator>() [1/5]

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

Definition at line 554 of file bigint.cpp.

◆ operator>() [2/5]

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

Definition at line 562 of file bigint.cpp.

◆ operator>() [3/5]

bool operator> ( const BigInt left,
intMpz  right 
)

Definition at line 558 of file bigint.cpp.

◆ operator>() [4/5]

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

Definition at line 570 of file bigint.cpp.

◆ operator>() [5/5]

bool operator> ( intMpz  left,
const BigInt right 
)

Definition at line 566 of file bigint.cpp.

◆ operator>=() [1/5]

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

Definition at line 594 of file bigint.cpp.

◆ operator>=() [2/5]

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

Definition at line 602 of file bigint.cpp.

◆ operator>=() [3/5]

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

Definition at line 598 of file bigint.cpp.

◆ operator>=() [4/5]

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

Definition at line 610 of file bigint.cpp.

◆ operator>=() [5/5]

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

Definition at line 606 of file bigint.cpp.

◆ operator>>()

BigInt operator>> ( BigInt  left,
int  right 
)

Definition at line 378 of file bigint.cpp.

◆ operator>>=()

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

Definition at line 402 of file bigint.cpp.

◆ operator^() [1/2]

BigInt operator^ ( BigInt  left,
const BigInt right 
)

Definition at line 469 of file bigint.cpp.

◆ operator^() [2/2]

BigInt operator^ ( const BigInt left,
intMpz  right 
)

Definition at line 474 of file bigint.cpp.

◆ operator^=() [1/2]

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

Definition at line 478 of file bigint.cpp.

◆ operator^=() [2/2]

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

Definition at line 483 of file bigint.cpp.

◆ operator|() [1/2]

BigInt operator| ( BigInt  left,
const BigInt right 
)

Definition at line 432 of file bigint.cpp.

◆ operator|() [2/2]

BigInt operator| ( const BigInt left,
intMpz  right 
)

Definition at line 437 of file bigint.cpp.

◆ operator|=() [1/2]

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

Definition at line 441 of file bigint.cpp.

◆ operator|=() [2/2]

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

Definition at line 446 of file bigint.cpp.

◆ operator~()

BigInt operator~ ( BigInt  left)

Definition at line 427 of file bigint.cpp.