diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-11-02 09:48:10 +0100 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-12-17 10:46:39 +0100 |
commit | fac01888d17423d6c23a9ce15d98fc88fb34e3cc (patch) | |
tree | 9a53718485b5521f4fb2ee6458e5cbaacf8d5033 /src/test/fuzz/util.h | |
parent | fa526d8fb6ab8f2678a30d4536aa9c45218f5269 (diff) | |
download | bitcoin-fac01888d17423d6c23a9ce15d98fc88fb34e3cc.tar.xz |
Move AdditionOverflow to util, Add CheckedAdd with unit tests
Diffstat (limited to 'src/test/fuzz/util.h')
-rw-r--r-- | src/test/fuzz/util.h | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/src/test/fuzz/util.h b/src/test/fuzz/util.h index 7937315822..f4f8e9e70d 100644 --- a/src/test/fuzz/util.h +++ b/src/test/fuzz/util.h @@ -193,17 +193,6 @@ template <typename T> } } -template <class T> -[[nodiscard]] bool AdditionOverflow(const T i, const T j) noexcept -{ - static_assert(std::is_integral<T>::value, "Integral required."); - if (std::numeric_limits<T>::is_signed) { - return (i > 0 && j > std::numeric_limits<T>::max() - i) || - (i < 0 && j < std::numeric_limits<T>::min() - i); - } - return std::numeric_limits<T>::max() - i < j; -} - [[nodiscard]] bool ContainsSpentInput(const CTransaction& tx, const CCoinsViewCache& inputs) noexcept; /** |