forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor] Refactor bignum header file into several files
- Loading branch information
Showing
6 changed files
with
1,045 additions
and
980 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) 2009-2010 Satoshi Nakamoto | ||
// Copyright (c) 2009-2012 The Bitcoin developers | ||
// Copyright (c) 2017-2019 The PIVX developers | ||
// Distributed under the MIT/X11 software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#include "bignum.h" | ||
|
||
#if defined(USE_NUM_GMP) | ||
#include "bignum_gmp.cpp" | ||
#endif | ||
|
||
#if defined(USE_NUM_OPENSSL) | ||
#include "bignum_openssl.cpp" | ||
#endif | ||
|
||
std::string CBigNum::GetHex() const | ||
{ | ||
return ToString(16); | ||
} | ||
|
||
std::string CBigNum::GetDec() const | ||
{ | ||
return ToString(10); | ||
} | ||
|
||
CBigNum CBigNum::pow(const int e) const | ||
{ | ||
return this->pow(CBigNum(e)); | ||
} | ||
|
||
void CBigNum::SetHex(const std::string& str) | ||
{ | ||
SetHexBool(str); | ||
} | ||
|
||
CBigNum& CBigNum::operator/=(const CBigNum& b) | ||
{ | ||
*this = *this / b; | ||
return *this; | ||
} | ||
|
||
CBigNum& CBigNum::operator%=(const CBigNum& b) | ||
{ | ||
*this = *this % b; | ||
return *this; | ||
} | ||
|
||
const CBigNum CBigNum::operator++(int) | ||
{ | ||
// postfix operator | ||
const CBigNum ret = *this; | ||
++(*this); | ||
return ret; | ||
} | ||
|
||
const CBigNum CBigNum::operator--(int) | ||
{ | ||
// postfix operator | ||
const CBigNum ret = *this; | ||
--(*this); | ||
return ret; | ||
} |
Oops, something went wrong.