fix bigint bugs

This commit is contained in:
Daniel Larimer 2013-07-17 20:55:36 -04:00
parent 0956cd26df
commit 2ef8cfa06e
2 changed files with 8 additions and 2 deletions

View file

@ -11,7 +11,8 @@ namespace fc {
public: public:
bigint( const std::vector<char>& bige ); bigint( const std::vector<char>& bige );
bigint( const char* bige, uint32_t l ); bigint( const char* bige, uint32_t l );
bigint( unsigned long i = 0 ); bigint( unsigned long i );
bigint( );
bigint( const bigint& c ); bigint( const bigint& c );
bigint( bigint&& c ); bigint( bigint&& c );
explicit bigint( BIGNUM* n ); explicit bigint( BIGNUM* n );

View file

@ -15,6 +15,9 @@ namespace fc {
{ {
n = BN_dup(in); n = BN_dup(in);
} }
bigint::bigint( )
:n(BN_new())
{ }
BIGNUM* bigint::dup()const BIGNUM* bigint::dup()const
{ {
@ -126,7 +129,9 @@ namespace fc {
bigint& bigint::operator <<= ( uint32_t i ) bigint& bigint::operator <<= ( uint32_t i )
{ {
BN_lshift( n, n, i ); bigint tmp;
BN_lshift( tmp.n, n, i );
std::swap(*this,tmp);
return *this; return *this;
} }