more bigint operators

This commit is contained in:
Daniel Larimer 2013-07-19 23:50:04 -04:00
parent f5f3bb5102
commit 72a1c45905
2 changed files with 8 additions and 0 deletions

View file

@ -43,6 +43,7 @@ namespace fc {
bigint operator % ( const bigint& a )const;
bigint operator /= ( const bigint& a );
bigint operator *= ( const bigint& a );
bigint& operator += ( const bigint& a );
bigint& operator <<= ( uint32_t i );
bigint operator - ( const bigint& a )const;

View file

@ -91,6 +91,13 @@ namespace fc {
BN_add( tmp.n, n, a.n );
return tmp;
}
bigint& bigint::operator += ( const bigint& a ){
bigint tmp(*this);
BN_add( tmp.n, n, a.n );
std::swap(*this,tmp);
return *this;
}
bigint bigint::operator * ( const bigint& a )const {
BN_CTX* ctx = BN_CTX_new();
bigint tmp(*this);