ht's Scheme Interpreter  1.0
a simplified scheme interpreter implementation
BigInt Class Reference

#include <bigint.hpp>

Public Member Functions

 BigInt (long long num)
 
 BigInt (const std::string &s)
 
 BigInt ()
 
BigIntassign (long long num)
 
BigIntassign (const std::string &s)
 
BigIntoperator+= (const BigInt &b)
 
BigIntoperator-= (const BigInt &b)
 
BigIntoperator*= (const BigInt &b)
 
BigIntoperator/= (const BigInt &b)
 
BigIntoperator%= (const BigInt &b)
 
BigInt operator+ (const BigInt &b) const
 
BigInt operator- (const BigInt &b) const
 
BigInt operator* (const BigInt &b) const
 
BigInt operator/ (const BigInt &b) const
 
BigInt operator% (const BigInt &b) const
 
BigInt operator- () const
 
bool operator> (const BigInt &b) const
 
bool operator< (const BigInt &b) const
 
bool operator== (const BigInt &b) const
 
bool operator!= (const BigInt &b) const
 
bool operator>= (const BigInt &b) const
 
bool operator<= (const BigInt &b) const
 

Private Member Functions

bool isZero () const
 
BigIntrawPlus (const BigInt &b)
 
BigIntrawMinus (const BigInt &b)
 
std::pair< BigInt &, BigIntdivandmod (const BigInt &b)
 
bool rawSmaller (const BigInt &b) const
 
bool rawGreater (const BigInt &b) const
 
BigIntsetSign (const bool sign)
 

Private Attributes

std::vector< int32_t > d
 
size_t len
 
bool nonNeg
 

Friends

std::istream & operator>> (std::istream &i, BigInt &b)
 
std::ostream & operator<< (std::ostream &o, const BigInt &b)
 
template<typename CompareFunc >
bool rawCompare (const BigInt &a, const BigInt &b)
 

Detailed Description

Definition at line 11 of file bigint.hpp.

Constructor & Destructor Documentation

BigInt::BigInt ( long long  num)

Definition at line 20 of file bigint.cpp.

BigInt::BigInt ( const std::string &  s)

Definition at line 25 of file bigint.cpp.

BigInt::BigInt ( )

Definition at line 30 of file bigint.cpp.

Member Function Documentation

BigInt & BigInt::assign ( long long  num)

Definition at line 35 of file bigint.cpp.

BigInt & BigInt::assign ( const std::string &  s)

Definition at line 56 of file bigint.cpp.

std::pair< BigInt &, BigInt > BigInt::divandmod ( const BigInt b)
private

Definition at line 315 of file bigint.cpp.

bool BigInt::isZero ( ) const
private

Definition at line 15 of file bigint.cpp.

bool BigInt::operator!= ( const BigInt b) const

Definition at line 146 of file bigint.cpp.

BigInt BigInt::operator% ( const BigInt b) const

Definition at line 370 of file bigint.cpp.

BigInt & BigInt::operator%= ( const BigInt b)

Definition at line 364 of file bigint.cpp.

BigInt BigInt::operator* ( const BigInt b) const

Definition at line 278 of file bigint.cpp.

BigInt & BigInt::operator*= ( const BigInt b)

Definition at line 303 of file bigint.cpp.

BigInt BigInt::operator+ ( const BigInt b) const

Definition at line 264 of file bigint.cpp.

BigInt & BigInt::operator+= ( const BigInt b)

Definition at line 202 of file bigint.cpp.

BigInt BigInt::operator- ( const BigInt b) const

Definition at line 271 of file bigint.cpp.

BigInt BigInt::operator- ( ) const

Definition at line 95 of file bigint.cpp.

BigInt & BigInt::operator-= ( const BigInt b)

Definition at line 235 of file bigint.cpp.

BigInt BigInt::operator/ ( const BigInt b) const

Definition at line 358 of file bigint.cpp.

BigInt & BigInt::operator/= ( const BigInt b)

Definition at line 353 of file bigint.cpp.

bool BigInt::operator< ( const BigInt b) const

Definition at line 124 of file bigint.cpp.

bool BigInt::operator<= ( const BigInt b) const

Definition at line 156 of file bigint.cpp.

bool BigInt::operator== ( const BigInt b) const

Definition at line 138 of file bigint.cpp.

bool BigInt::operator> ( const BigInt b) const

Definition at line 133 of file bigint.cpp.

bool BigInt::operator>= ( const BigInt b) const

Definition at line 151 of file bigint.cpp.

bool BigInt::rawGreater ( const BigInt b) const
private

Definition at line 119 of file bigint.cpp.

BigInt & BigInt::rawMinus ( const BigInt b)
private

Definition at line 182 of file bigint.cpp.

BigInt & BigInt::rawPlus ( const BigInt b)
private

Definition at line 161 of file bigint.cpp.

bool BigInt::rawSmaller ( const BigInt b) const
private

Definition at line 114 of file bigint.cpp.

BigInt & BigInt::setSign ( const bool  sign)
private

Definition at line 309 of file bigint.cpp.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const BigInt b 
)
friend

Definition at line 248 of file bigint.cpp.

std::istream& operator>> ( std::istream &  i,
BigInt b 
)
friend

Definition at line 240 of file bigint.cpp.

template<typename CompareFunc >
bool rawCompare ( const BigInt a,
const BigInt b 
)
friend

Definition at line 104 of file bigint.cpp.

Member Data Documentation

std::vector<int32_t> BigInt::d
private

Definition at line 14 of file bigint.hpp.

size_t BigInt::len
private

Definition at line 15 of file bigint.hpp.

bool BigInt::nonNeg
private

Definition at line 16 of file bigint.hpp.


The documentation for this class was generated from the following files: