aboutsummaryrefslogtreecommitdiff
path: root/src/uint256.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2020-09-25 15:01:38 +1000
committerAnthony Towns <aj@erisian.com.au>2020-09-28 12:14:19 +1000
commit183f308fff4caad3e3ada654b6fdf597d262c4c1 (patch)
tree2cabf5cc8477e418159670ed73be97daa96b0bdd /src/uint256.cpp
parent78f912c9010f686e2d1bbdc1c51f381b496c2a1b (diff)
downloadbitcoin-183f308fff4caad3e3ada654b6fdf597d262c4c1.tar.xz
uint256: Update constructors to c++11, make ONE static
Replace the memset with C++11 value/aggregate initialisation of the m_data array, which still ensures the unspecified values end up as zero-initialised. This then allows changing UINT256_ONE() from dynamically allocating an object, to a simpler referencing a static allocation.
Diffstat (limited to 'src/uint256.cpp')
-rw-r--r--src/uint256.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/uint256.cpp b/src/uint256.cpp
index ee1b34eadd..d074df2f20 100644
--- a/src/uint256.cpp
+++ b/src/uint256.cpp
@@ -80,7 +80,4 @@ template std::string base_blob<256>::ToString() const;
template void base_blob<256>::SetHex(const char*);
template void base_blob<256>::SetHex(const std::string&);
-uint256& UINT256_ONE() {
- static uint256* one = new uint256(uint256S("0000000000000000000000000000000000000000000000000000000000000001"));
- return *one;
-}
+const uint256 uint256::ONE(1);