Skip to content

Commit

Permalink
fix: bignum
Browse files Browse the repository at this point in the history
  • Loading branch information
as-iotex authored and as-iotex committed Apr 17, 2022
1 parent 1af7b05 commit 0854a4c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/bignum/bignum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ IotexString Bignum::ToString(NumericBase base) const
{
if (base == NumericBase::Base10)
{
return _u256.str(10);
// Return c_str() so Arduino converts to the proper IotexString (either String or std::string)
return IotexString(_u256.str(10).c_str());
}
else if (base == NumericBase::Base16)
{
return _u256.str(16);
// Return c_str() so Arduino converts to the proper IotexString (either String or std::string)
return IotexString(_u256.str(16).c_str());
}
else return "";
}

Bignum& Bignum::operator=(const Bignum& bignum)
{
_u256 = uint256_t(bignum.ToString(NumericBase::Base16), 16);
_u256 = uint256_t(bignum.ToString(NumericBase::Base16).c_str(), 16);
return *this;
}

0 comments on commit 0854a4c

Please sign in to comment.