diff options
author | Pieter Wuille <pieter@wuille.net> | 2022-09-15 16:48:50 -0400 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2022-09-15 16:48:50 -0400 |
commit | 04fee75bacb9ec3bceff1246ba6c8ed8a8759548 (patch) | |
tree | d5b6fd7edd4df0780a0ad23646f9fce6b22b0188 /src/uint256.h | |
parent | a56876e6b9dab4e0080cb8d7e9d0b4dd117f79a8 (diff) |
Use ReadLE64 in uint256::GetUint64() instead of duplicating logic
Diffstat (limited to 'src/uint256.h')
-rw-r--r-- | src/uint256.h | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/uint256.h b/src/uint256.h index 5c3a2f5409..e74b9ff7b1 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_UINT256_H #define BITCOIN_UINT256_H +#include <crypto/common.h> #include <span.h> #include <assert.h> @@ -84,15 +85,7 @@ public: uint64_t GetUint64(int pos) const { - const uint8_t* ptr = m_data + pos * 8; - return ((uint64_t)ptr[0]) | \ - ((uint64_t)ptr[1]) << 8 | \ - ((uint64_t)ptr[2]) << 16 | \ - ((uint64_t)ptr[3]) << 24 | \ - ((uint64_t)ptr[4]) << 32 | \ - ((uint64_t)ptr[5]) << 40 | \ - ((uint64_t)ptr[6]) << 48 | \ - ((uint64_t)ptr[7]) << 56; + return ReadLE64(m_data + pos * 8); } template<typename Stream> |