diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2014-09-04 23:48:01 +0200 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2014-09-04 23:49:35 +0200 |
commit | af9c3b0cffa4449f1254da3073aef77bafddf9cd (patch) | |
tree | 7f76c41b2a5556b9836bde8691ee4af9c3030dae /src/uint256.h | |
parent | b4cd0975fbc93063473a4d9a09e2b2fe3c4ad489 (diff) | |
parent | 1e4f87f5a13e34a457b537e9d13a212e6c5b754f (diff) |
Merge pull request #4838
1e4f87f Use memcmp for uint256 equality/inequality (Pieter Wuille)
8a41e1e Use boost::unordered_map for mapBlockIndex (Pieter Wuille)
145d5be Introduce BlockMap type for mapBlockIndex (Pieter Wuille)
a0dbe43 checkpoints.cpp depends on main, it can use mapBlockIndex directly (Pieter Wuille)
Diffstat (limited to 'src/uint256.h')
-rw-r--r-- | src/uint256.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/uint256.h b/src/uint256.h index d1a822af0d..6bb9a59400 100644 --- a/src/uint256.h +++ b/src/uint256.h @@ -10,6 +10,7 @@ #include <stdexcept> #include <stdint.h> #include <string> +#include <cstring> #include <vector> class uint_error : public std::runtime_error { @@ -215,8 +216,8 @@ public: friend inline const base_uint operator>>(const base_uint& a, int shift) { return base_uint(a) >>= shift; } friend inline const base_uint operator<<(const base_uint& a, int shift) { return base_uint(a) <<= shift; } friend inline const base_uint operator*(const base_uint& a, uint32_t b) { return base_uint(a) *= b; } - friend inline bool operator==(const base_uint& a, const base_uint& b) { return a.CompareTo(b) == 0; } - friend inline bool operator!=(const base_uint& a, const base_uint& b) { return a.CompareTo(b) != 0; } + friend inline bool operator==(const base_uint& a, const base_uint& b) { return memcmp(a.pn, b.pn, sizeof(a.pn)) == 0; } + friend inline bool operator!=(const base_uint& a, const base_uint& b) { return memcmp(a.pn, b.pn, sizeof(a.pn)) != 0; } friend inline bool operator>(const base_uint& a, const base_uint& b) { return a.CompareTo(b) > 0; } friend inline bool operator<(const base_uint& a, const base_uint& b) { return a.CompareTo(b) < 0; } friend inline bool operator>=(const base_uint& a, const base_uint& b) { return a.CompareTo(b) >= 0; } |