From 183f308fff4caad3e3ada654b6fdf597d262c4c1 Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Fri, 25 Sep 2020 15:01:38 +1000 Subject: 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. --- src/uint256.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/uint256.cpp') diff --git a/src/uint256.cpp b/src/uint256.cpp index ee1b34ead..d074df2f2 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); -- cgit v1.2.3