fix bugs with bigint
This commit is contained in:
parent
786941fe69
commit
f954ff1a25
2 changed files with 9 additions and 1 deletions
|
|
@ -44,6 +44,7 @@ namespace fc {
|
||||||
bigint operator /= ( const bigint& a );
|
bigint operator /= ( const bigint& a );
|
||||||
bigint operator *= ( const bigint& a );
|
bigint operator *= ( const bigint& a );
|
||||||
bigint& operator += ( const bigint& a );
|
bigint& operator += ( const bigint& a );
|
||||||
|
bigint& operator -= ( const bigint& a );
|
||||||
bigint& operator <<= ( uint32_t i );
|
bigint& operator <<= ( uint32_t i );
|
||||||
bigint& operator >>= ( uint32_t i );
|
bigint& operator >>= ( uint32_t i );
|
||||||
bigint operator - ( const bigint& a )const;
|
bigint operator - ( const bigint& a )const;
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ namespace fc {
|
||||||
return BN_cmp( n, c.n ) == 0;
|
return BN_cmp( n, c.n ) == 0;
|
||||||
}
|
}
|
||||||
bool bigint::operator != ( const bigint& c )const {
|
bool bigint::operator != ( const bigint& c )const {
|
||||||
return BN_cmp( n, c.n ) == 0;
|
return BN_cmp( n, c.n ) != 0;
|
||||||
}
|
}
|
||||||
bigint::operator bool()const
|
bigint::operator bool()const
|
||||||
{
|
{
|
||||||
|
|
@ -97,6 +97,13 @@ namespace fc {
|
||||||
std::swap(*this,tmp);
|
std::swap(*this,tmp);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
bigint& bigint::operator -= ( const bigint& a ){
|
||||||
|
bigint tmp(*this);
|
||||||
|
BN_sub( tmp.n, n, a.n );
|
||||||
|
std::swap(*this,tmp);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bigint bigint::operator * ( const bigint& a )const {
|
bigint bigint::operator * ( const bigint& a )const {
|
||||||
BN_CTX* ctx = BN_CTX_new();
|
BN_CTX* ctx = BN_CTX_new();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue