diff --git a/include/bitcoin/system/chain/operation.hpp b/include/bitcoin/system/chain/operation.hpp index 5e0d5cd80a..bedff67ae9 100644 --- a/include/bitcoin/system/chain/operation.hpp +++ b/include/bitcoin/system/chain/operation.hpp @@ -48,9 +48,9 @@ class BC_API operation static constexpr opcode opcode_from_version(uint8_t value) NOEXCEPT; static constexpr opcode opcode_from_positive(uint8_t value) NOEXCEPT; - static VCONSTEXPR opcode minimal_opcode_from_data( + static constexpr opcode minimal_opcode_from_data( const data_chunk& data) NOEXCEPT; - static VCONSTEXPR opcode nominal_opcode_from_data( + static constexpr opcode nominal_opcode_from_data( const data_chunk& data) NOEXCEPT; /// Categories of opcodes. diff --git a/include/bitcoin/system/chain/script.hpp b/include/bitcoin/system/chain/script.hpp index 4df1506a52..b1e70de9ad 100644 --- a/include/bitcoin/system/chain/script.hpp +++ b/include/bitcoin/system/chain/script.hpp @@ -50,23 +50,23 @@ class BC_API script /// Determine if the flag is enabled in the active flags set. static constexpr bool is_enabled(uint32_t active_flags, flags flag) NOEXCEPT; - static VCONSTEXPR bool is_push_only_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_relaxed_push_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_commitment_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_witness_program_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_null_data_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_op_return_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_multisig_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_public_key_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_key_hash_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_script_hash_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_witness_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_witness_key_hash_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_pay_witness_script_hash_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_sign_multisig_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_sign_public_key_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_sign_key_hash_pattern(const operations& ops) NOEXCEPT; - static VCONSTEXPR bool is_sign_script_hash_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_push_only_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_relaxed_push_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_commitment_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_witness_program_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_null_data_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_op_return_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_multisig_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_public_key_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_key_hash_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_script_hash_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_witness_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_witness_key_hash_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_pay_witness_script_hash_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_sign_multisig_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_sign_public_key_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_sign_key_hash_pattern(const operations& ops) NOEXCEPT; + static constexpr bool is_sign_script_hash_pattern(const operations& ops) NOEXCEPT; static bool is_coinbase_pattern(const operations& ops, size_t height) NOEXCEPT; static inline operations to_pay_null_data_pattern( diff --git a/include/bitcoin/system/chain/witness.hpp b/include/bitcoin/system/chain/witness.hpp index 2e3544e3fe..28e9df972e 100644 --- a/include/bitcoin/system/chain/witness.hpp +++ b/include/bitcoin/system/chain/witness.hpp @@ -98,7 +98,7 @@ class BC_API witness /// Skip a witness (as if deserialized). static void skip(reader& source, bool prefix) NOEXCEPT; - static VCONSTEXPR bool is_push_size(const chunk_cptrs& stack) NOEXCEPT + static constexpr bool is_push_size(const chunk_cptrs& stack) NOEXCEPT { return std::all_of(stack.begin(), stack.end(), [](const auto& element) NOEXCEPT @@ -108,7 +108,7 @@ class BC_API witness } /// The (only) coinbase witness must be (arbitrary) 32-byte value (bip141). - static VCONSTEXPR bool is_reserved_pattern(const chunk_cptrs& stack) NOEXCEPT + static constexpr bool is_reserved_pattern(const chunk_cptrs& stack) NOEXCEPT { return is_one(stack.size()) && stack.front()->size() == hash_size; } diff --git a/include/bitcoin/system/data/data_reference.hpp b/include/bitcoin/system/data/data_reference.hpp index ab3b7a1fbf..9b64783323 100644 --- a/include/bitcoin/system/data/data_reference.hpp +++ b/include/bitcoin/system/data/data_reference.hpp @@ -58,10 +58,10 @@ class data_reference constexpr data_reference(const data_slice& data) NOEXCEPT; /// std::string constructor (casts char to uint8_t). - SCONSTEXPR data_reference(const std::string& text) NOEXCEPT; + constexpr data_reference(const std::string& text) NOEXCEPT; /// data_chunk constructor. - VCONSTEXPR data_reference(const data_chunk& data) NOEXCEPT; + constexpr data_reference(const data_chunk& data) NOEXCEPT; /// data_array constructor. template @@ -73,7 +73,7 @@ class data_reference /// Byte vector constructor (casts Byte to uint8_t). template = true> - VCONSTEXPR data_reference(const std_vector& data) NOEXCEPT; + constexpr data_reference(const std_vector& data) NOEXCEPT; /// Byte iterators constructor (casts to uint8_t). template diff --git a/include/bitcoin/system/data/data_slab.hpp b/include/bitcoin/system/data/data_slab.hpp index 7e3f9573d1..b0dda857af 100644 --- a/include/bitcoin/system/data/data_slab.hpp +++ b/include/bitcoin/system/data/data_slab.hpp @@ -70,7 +70,7 @@ class data_slab // TODO: test. /// Byte vector constructor (casts Byte to uint8_t). template = true> - VCONSTEXPR data_slab(std_vector& data) NOEXCEPT; + constexpr data_slab(std_vector& data) NOEXCEPT; // TODO: restrict to iterator-to-non-const references. /// Byte iterators constructor (casts to uint8_t). @@ -84,7 +84,7 @@ class data_slab // TODO: test. /// String constructor (casts char to uint8_t). - SCONSTEXPR data_slab(std::string& text) NOEXCEPT; + constexpr data_slab(std::string& text) NOEXCEPT; /// Methods. /// ----------------------------------------------------------------------- @@ -98,7 +98,7 @@ class data_slab inline std_vector to_chunk() const NOEXCEPT; /// Convert data to a string (casts uint8_t to char). - SCONSTEXPR std::string to_string() const NOEXCEPT; + constexpr std::string to_string() const NOEXCEPT; /// Cast buffer to a data_slice. constexpr data_slice to_slice() const NOEXCEPT; @@ -122,7 +122,7 @@ class data_slab /// ----------------------------------------------------------------------- ////template ////constexpr operator std_array() const NOEXCEPT; - ////VCONSTEXPR operator std_vector() const NOEXCEPT; + ////constexpr operator std_vector() const NOEXCEPT; constexpr operator data_slice() const NOEXCEPT; constexpr value_type operator[](size_type index) const NOEXCEPT; @@ -139,7 +139,7 @@ class data_slab size_type size) NOEXCEPT; template - static SVCONSTEXPR data_slab from_size_(const Pointer begin, + static constexpr data_slab from_size_(const Pointer begin, size_type size) NOEXCEPT; pointer begin_; diff --git a/include/bitcoin/system/data/data_slice.hpp b/include/bitcoin/system/data/data_slice.hpp index 0205e34691..9b780d506f 100644 --- a/include/bitcoin/system/data/data_slice.hpp +++ b/include/bitcoin/system/data/data_slice.hpp @@ -79,7 +79,7 @@ class data_slice /// Byte vector constructor (casts Byte to uint8_t). template = true> - VCONSTEXPR data_slice(const std_vector& data) NOEXCEPT; + constexpr data_slice(const std_vector& data) NOEXCEPT; // TODO: restrict to iterator-to-const references. /// Byte iterators constructor (casts to uint8_t). @@ -92,10 +92,10 @@ class data_slice constexpr data_slice(const Byte* begin, const Byte* end) NOEXCEPT; /// String constructor (casts char to uint8_t). - SCONSTEXPR data_slice(const std::string& text) NOEXCEPT; + constexpr data_slice(const std::string& text) NOEXCEPT; /// Byte initializer list constructor. - SVCONSTEXPR data_slice(std::initializer_list bytes) NOEXCEPT; + constexpr data_slice(std::initializer_list bytes) NOEXCEPT; /// Methods. /// ----------------------------------------------------------------------- @@ -109,7 +109,7 @@ class data_slice inline std_vector to_chunk() const NOEXCEPT; /// Convert data to a string (casts uint8_t to char). - SCONSTEXPR std::string to_string() const NOEXCEPT; + constexpr std::string to_string() const NOEXCEPT; /// Resize the slice by decrementing the end pointer. /// This is the only mutable action that can be taken on the slice. @@ -130,7 +130,7 @@ class data_slice /// ----------------------------------------------------------------------- ////template ////constexpr operator std_array() const NOEXCEPT; - ////VCONSTEXPR operator std_vector() const NOEXCEPT; + ////constexpr operator std_vector() const NOEXCEPT; constexpr value_type operator[](size_type index) const NOEXCEPT; private: @@ -149,7 +149,7 @@ class data_slice Pointer begin, size_type size) NOEXCEPT; template - static SVCONSTEXPR data_slice from_size_( + static constexpr data_slice from_size_( Pointer begin, size_type size) NOEXCEPT; pointer begin_; diff --git a/include/bitcoin/system/data/exclusive_slice.hpp b/include/bitcoin/system/data/exclusive_slice.hpp index 48f597839a..b5ff0744f1 100644 --- a/include/bitcoin/system/data/exclusive_slice.hpp +++ b/include/bitcoin/system/data/exclusive_slice.hpp @@ -59,12 +59,12 @@ class exclusive_slice { } - SCONSTEXPR exclusive_slice(const std::string& text) NOEXCEPT + constexpr exclusive_slice(const std::string& text) NOEXCEPT : data_slice(text) { } - SVCONSTEXPR exclusive_slice(std::initializer_list bytes) NOEXCEPT + constexpr exclusive_slice(std::initializer_list bytes) NOEXCEPT : data_slice(bytes.begin(), bytes.end()) { } diff --git a/include/bitcoin/system/data/string.hpp b/include/bitcoin/system/data/string.hpp index 48f8fddca3..367400e8d7 100644 --- a/include/bitcoin/system/data/string.hpp +++ b/include/bitcoin/system/data/string.hpp @@ -31,7 +31,7 @@ namespace system { /// Casts bytes directly into the string member. /// to_string(to_chunk(string)) == string. /// to_string(to_array(string)) == string. -SCONSTEXPR std::string to_string(const data_slice& bytes) NOEXCEPT +constexpr std::string to_string(const data_slice& bytes) NOEXCEPT { return bytes.to_string(); } diff --git a/include/bitcoin/system/endian/integers.hpp b/include/bitcoin/system/endian/integers.hpp index 6ddef662da..2bc0bcc6e9 100644 --- a/include/bitcoin/system/endian/integers.hpp +++ b/include/bitcoin/system/endian/integers.hpp @@ -50,7 +50,7 @@ constexpr Integer from_big_array(size_t length, const data_array& data) NOEXCEPT; template = true> -VCONSTEXPR Integer from_big_chunk(size_t length, +constexpr Integer from_big_chunk(size_t length, const data_chunk& data) NOEXCEPT; /// Native endianness integer from little-endian data. @@ -65,7 +65,7 @@ constexpr Integer from_little_array(size_t length, const data_array& data) NOEXCEPT; template = true> -VCONSTEXPR Integer from_little_chunk(size_t length, +constexpr Integer from_little_chunk(size_t length, const data_chunk& data) NOEXCEPT; } // namespace system diff --git a/include/bitcoin/system/endian/nominal.hpp b/include/bitcoin/system/endian/nominal.hpp index 41cf01cf4d..9869d34725 100644 --- a/include/bitcoin/system/endian/nominal.hpp +++ b/include/bitcoin/system/endian/nominal.hpp @@ -59,11 +59,11 @@ constexpr Integral from_little_endian(const data_array& data) NOEXCEPT; template = true> -VCONSTEXPR Integral from_big_endian(const data_chunk& data) NOEXCEPT; +constexpr Integral from_big_endian(const data_chunk& data) NOEXCEPT; template = true> -VCONSTEXPR Integral from_little_endian(const data_chunk& data) NOEXCEPT; +constexpr Integral from_little_endian(const data_chunk& data) NOEXCEPT; } // namespace system } // namespace libbitcoin diff --git a/include/bitcoin/system/endian/uintx_t.hpp b/include/bitcoin/system/endian/uintx_t.hpp index 3ae546544f..d8b014e27f 100644 --- a/include/bitcoin/system/endian/uintx_t.hpp +++ b/include/bitcoin/system/endian/uintx_t.hpp @@ -49,11 +49,11 @@ constexpr uintx_t uintx_from_little_endian_array( const data_array& data) NOEXCEPT; template -VCONSTEXPR uintx_t uintx_from_big_endian_chunk( +constexpr uintx_t uintx_from_big_endian_chunk( const data_chunk& data) NOEXCEPT; template -VCONSTEXPR uintx_t uintx_from_little_endian_chunk( +constexpr uintx_t uintx_from_little_endian_chunk( const data_chunk& data) NOEXCEPT; } // namespace system diff --git a/include/bitcoin/system/hash/sha/algorithm.hpp b/include/bitcoin/system/hash/sha/algorithm.hpp index 400460b5c8..7258aa7d62 100644 --- a/include/bitcoin/system/hash/sha/algorithm.hpp +++ b/include/bitcoin/system/hash/sha/algorithm.hpp @@ -126,8 +126,8 @@ class algorithm /// Merkle hashing (sha256/512). /// ----------------------------------------------------------------------- - static VCONSTEXPR digests_t& merkle_hash(digests_t& digests) NOEXCEPT; - static VCONSTEXPR digest_t merkle_root(digests_t&& digests) NOEXCEPT; + static constexpr digests_t& merkle_hash(digests_t& digests) NOEXCEPT; + static constexpr digest_t merkle_root(digests_t&& digests) NOEXCEPT; protected: /// Intrinsics constants. @@ -341,7 +341,7 @@ class algorithm INLINE static void merkle_hash_vector(idigests_t& digests, iblocks_t& blocks) NOEXCEPT; INLINE static void merkle_hash_vector(digests_t& digests) NOEXCEPT; - VCONSTEXPR static void merkle_hash_(digests_t& digests, + constexpr static void merkle_hash_(digests_t& digests, size_t offset=zero) NOEXCEPT; /// sigma0 vectorization (single blocks). diff --git a/include/bitcoin/system/have.hpp b/include/bitcoin/system/have.hpp index 41915e43cb..31ed4f9758 100644 --- a/include/bitcoin/system/have.hpp +++ b/include/bitcoin/system/have.hpp @@ -189,30 +189,18 @@ #if defined(HAVE_CPP20) // All versions. #if defined(HAVE_MSC) - #define HAVE_RANGES #define HAVE_CONSTEVAL - #define HAVE_STRING_CONSTEXPR - #define HAVE_VECTOR_CONSTEXPR #elif defined(HAVE_CLANG) // Apple clang version 15 #if defined(HAVE_APPLE) - #define HAVE_RANGES #define HAVE_CONSTEVAL - #define HAVE_STRING_CONSTEXPR - #define HAVE_VECTOR_CONSTEXPR // Ubuntu clang version 16 #else - #define HAVE_RANGES ////#define HAVE_CONSTEVAL (v17) - #define HAVE_STRING_CONSTEXPR - #define HAVE_VECTOR_CONSTEXPR #endif // gcc version 12 #elif defined(HAVE_GCC) - #define HAVE_RANGES #define HAVE_CONSTEVAL - #define HAVE_STRING_CONSTEXPR - #define HAVE_VECTOR_CONSTEXPR #endif #endif diff --git a/include/bitcoin/system/impl/chain/operation.ipp b/include/bitcoin/system/impl/chain/operation.ipp index bb121eff55..f090057c93 100644 --- a/include/bitcoin/system/impl/chain/operation.ipp +++ b/include/bitcoin/system/impl/chain/operation.ipp @@ -97,7 +97,7 @@ constexpr opcode operation::opcode_from_positive(uint8_t value) NOEXCEPT // Compute the minimal data opcode for a given chunk of data. // Caller should clear data if converting to non-payload opcode. -VCONSTEXPR opcode operation::minimal_opcode_from_data( +constexpr opcode operation::minimal_opcode_from_data( const data_chunk& data) NOEXCEPT { const auto size = data.size(); @@ -123,7 +123,7 @@ VCONSTEXPR opcode operation::minimal_opcode_from_data( // Compute the nominal data opcode for a given chunk of data. // Restricted to sized data, avoids conversion to numeric opcodes. -VCONSTEXPR opcode operation::nominal_opcode_from_data( +constexpr opcode operation::nominal_opcode_from_data( const data_chunk& data) NOEXCEPT { return opcode_from_size(data.size()); diff --git a/include/bitcoin/system/impl/chain/script.ipp b/include/bitcoin/system/impl/chain/script.ipp index cfd25f32c7..b93e312df2 100644 --- a/include/bitcoin/system/impl/chain/script.ipp +++ b/include/bitcoin/system/impl/chain/script.ipp @@ -40,7 +40,7 @@ constexpr bool script::is_enabled(uint32_t active_flags, flags flag) NOEXCEPT return to_bool(flag & active_flags); } -VCONSTEXPR bool script::is_push_only_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_push_only_pattern(const operations& ops) NOEXCEPT { const auto push = [](const operation& op) NOEXCEPT { @@ -53,7 +53,7 @@ VCONSTEXPR bool script::is_push_only_pattern(const operations& ops) NOEXCEPT // **************************************************************************** // CONSENSUS: this pattern is used to activate bip16 validation rules. // **************************************************************************** -VCONSTEXPR bool script::is_relaxed_push_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_relaxed_push_pattern(const operations& ops) NOEXCEPT { const auto push = [&](const operation& op) NOEXCEPT { @@ -66,7 +66,7 @@ VCONSTEXPR bool script::is_relaxed_push_pattern(const operations& ops) NOEXCEPT // **************************************************************************** // CONSENSUS: this pattern is used to commit to bip141 witness data. // **************************************************************************** -VCONSTEXPR bool script::is_commitment_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_commitment_pattern(const operations& ops) NOEXCEPT { constexpr auto header = to_big_endian(chain::witness_head); @@ -83,7 +83,7 @@ VCONSTEXPR bool script::is_commitment_pattern(const operations& ops) NOEXCEPT // **************************************************************************** // CONSENSUS: this pattern is used in bip141 validation rules. // **************************************************************************** -VCONSTEXPR bool script::is_witness_program_pattern( +constexpr bool script::is_witness_program_pattern( const operations& ops) NOEXCEPT { return ops.size() == 2 @@ -94,7 +94,7 @@ VCONSTEXPR bool script::is_witness_program_pattern( } // The satoshi client now enables configurable data size for policy. -VCONSTEXPR bool script::is_pay_null_data_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_pay_null_data_pattern(const operations& ops) NOEXCEPT { return ops.size() == 2 && ops[0].code() == opcode::op_return @@ -103,7 +103,7 @@ VCONSTEXPR bool script::is_pay_null_data_pattern(const operations& ops) NOEXCEPT } // Used by neutrino. -VCONSTEXPR bool script::is_pay_op_return_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_pay_op_return_pattern(const operations& ops) NOEXCEPT { return !ops.empty() && ops[0].code() == opcode::op_return; @@ -112,7 +112,7 @@ VCONSTEXPR bool script::is_pay_op_return_pattern(const operations& ops) NOEXCEPT // The current 16 (or 20) limit does not affect server indexing because bare // multisig is not indexable and p2sh multisig is byte-limited to 15 sigs. // The satoshi client policy limit is 3 signatures for bare multisig. -VCONSTEXPR bool script::is_pay_multisig_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_pay_multisig_pattern(const operations& ops) NOEXCEPT { constexpr auto op_1 = static_cast(opcode::push_positive_1); constexpr auto op_16 = static_cast(opcode::push_positive_16); @@ -145,7 +145,7 @@ VCONSTEXPR bool script::is_pay_multisig_pattern(const operations& ops) NOEXCEPT } // The satoshi client considers this non-standard for policy. -VCONSTEXPR bool script::is_pay_public_key_pattern( +constexpr bool script::is_pay_public_key_pattern( const operations& ops) NOEXCEPT { return ops.size() == 2 @@ -153,7 +153,7 @@ VCONSTEXPR bool script::is_pay_public_key_pattern( && ops[1].code() == opcode::checksig; } -VCONSTEXPR bool script::is_pay_key_hash_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_pay_key_hash_pattern(const operations& ops) NOEXCEPT { return ops.size() == 5 && ops[0].code() == opcode::dup @@ -166,7 +166,7 @@ VCONSTEXPR bool script::is_pay_key_hash_pattern(const operations& ops) NOEXCEPT // **************************************************************************** // CONSENSUS: this pattern is used to activate bip16 validation rules. // **************************************************************************** -VCONSTEXPR bool script::is_pay_script_hash_pattern( +constexpr bool script::is_pay_script_hash_pattern( const operations& ops) NOEXCEPT { return ops.size() == 3 @@ -175,14 +175,14 @@ VCONSTEXPR bool script::is_pay_script_hash_pattern( && ops[2].code() == opcode::equal; } -VCONSTEXPR bool script::is_pay_witness_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_pay_witness_pattern(const operations& ops) NOEXCEPT { return ops.size() == 2 && ops[0].is_version() && ops[1].is_push(); } -VCONSTEXPR bool script::is_pay_witness_key_hash_pattern( +constexpr bool script::is_pay_witness_key_hash_pattern( const operations& ops) NOEXCEPT { return ops.size() == 2 @@ -193,7 +193,7 @@ VCONSTEXPR bool script::is_pay_witness_key_hash_pattern( // **************************************************************************** // CONSENSUS: this pattern is used to activate bip141 validation rules. // **************************************************************************** -VCONSTEXPR bool script::is_pay_witness_script_hash_pattern( +constexpr bool script::is_pay_witness_script_hash_pattern( const operations& ops) NOEXCEPT { return ops.size() == 2 @@ -204,7 +204,7 @@ VCONSTEXPR bool script::is_pay_witness_script_hash_pattern( // The first push is based on wacky satoshi op_check_multisig behavior that // we must perpetuate, though it's appearance here is policy not consensus. // Limiting to push_size_0 removes pattern ambiguity with little downside. -VCONSTEXPR bool script::is_sign_multisig_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_sign_multisig_pattern(const operations& ops) NOEXCEPT { const auto endorsement = [](const operation& op) NOEXCEPT { @@ -216,7 +216,7 @@ VCONSTEXPR bool script::is_sign_multisig_pattern(const operations& ops) NOEXCEPT && std::all_of(std::next(ops.begin()), ops.end(), endorsement); } -VCONSTEXPR bool script::is_sign_public_key_pattern( +constexpr bool script::is_sign_public_key_pattern( const operations& ops) NOEXCEPT { return ops.size() == 1 @@ -226,7 +226,7 @@ VCONSTEXPR bool script::is_sign_public_key_pattern( // **************************************************************************** // CONSENSUS: this pattern is used to activate bip141 validation rules. // **************************************************************************** -VCONSTEXPR bool script::is_sign_key_hash_pattern(const operations& ops) NOEXCEPT +constexpr bool script::is_sign_key_hash_pattern(const operations& ops) NOEXCEPT { return ops.size() == 2 && is_endorsement(ops[0].data()) @@ -236,7 +236,7 @@ VCONSTEXPR bool script::is_sign_key_hash_pattern(const operations& ops) NOEXCEPT // Ambiguous with is_sign_key_hash when second/last op is a public key. // Ambiguous with is_sign_public_key_pattern when only op is endorsement. -VCONSTEXPR bool script::is_sign_script_hash_pattern( +constexpr bool script::is_sign_script_hash_pattern( const operations& ops) NOEXCEPT { return !ops.empty() diff --git a/include/bitcoin/system/impl/data/data_reference.ipp b/include/bitcoin/system/impl/data/data_reference.ipp index bb3e3fcf45..362e2e5ecd 100644 --- a/include/bitcoin/system/impl/data/data_reference.ipp +++ b/include/bitcoin/system/impl/data/data_reference.ipp @@ -39,14 +39,14 @@ constexpr data_reference::data_reference(const data_slice& data) NOEXCEPT { } -// data_slice(std::string) is SCONSTEXPR. -SCONSTEXPR data_reference::data_reference(const std::string& text) NOEXCEPT +// data_slice(std::string) is constexpr. +constexpr data_reference::data_reference(const std::string& text) NOEXCEPT : data_slice(text) { } -// data_slice(std_vector) is VCONSTEXPR. -VCONSTEXPR data_reference::data_reference(const data_chunk& data) NOEXCEPT +// data_slice(std_vector) is constexpr. +constexpr data_reference::data_reference(const data_chunk& data) NOEXCEPT : data_slice(data) { } @@ -66,10 +66,10 @@ constexpr data_reference::data_reference( { } -// data_slice(std_vector) is VCONSTEXPR. +// data_slice(std_vector) is constexpr. // Byte vector constructor (casts Byte to uint8_t). template > -VCONSTEXPR data_reference::data_reference( +constexpr data_reference::data_reference( const std_vector& data) NOEXCEPT : data_slice(data) { diff --git a/include/bitcoin/system/impl/data/data_slab.ipp b/include/bitcoin/system/impl/data/data_slab.ipp index 764c79a7d8..4ab2ac341e 100644 --- a/include/bitcoin/system/impl/data/data_slab.ipp +++ b/include/bitcoin/system/impl/data/data_slab.ipp @@ -38,7 +38,7 @@ constexpr data_slab::data_slab(std_array& data) NOEXCEPT // std_vector.begin not constexpr (need full C++20). template > -VCONSTEXPR data_slab::data_slab(std_vector& data) NOEXCEPT +constexpr data_slab::data_slab(std_vector& data) NOEXCEPT : data_slab(from_size_(data.begin(), data.size())) { } @@ -62,7 +62,7 @@ constexpr data_slab::data_slab() NOEXCEPT } // std::string.begin not constexpr (need full C++20). -SCONSTEXPR data_slab::data_slab(std::string& text) NOEXCEPT +constexpr data_slab::data_slab(std::string& text) NOEXCEPT : data_slab(from_size_(text.begin(), text.size())) { } @@ -113,7 +113,7 @@ constexpr data_slab data_slab::from_size(const Pointer begin, // static template -SVCONSTEXPR data_slab data_slab::from_size_(const Pointer begin, +constexpr data_slab data_slab::from_size_(const Pointer begin, size_type size) NOEXCEPT { return from_size(begin, size); @@ -127,7 +127,7 @@ inline std_vector data_slab::to_chunk() const NOEXCEPT return { begin_, end_ }; } -SCONSTEXPR std::string data_slab::to_string() const NOEXCEPT +constexpr std::string data_slab::to_string() const NOEXCEPT { return { begin_, end_ }; } @@ -217,7 +217,7 @@ constexpr bool data_slab::empty() const NOEXCEPT //// return to_array(); ////} //// -////VCONSTEXPR data_slab::operator +////constexpr data_slab::operator ////std_vector() const NOEXCEPT ////{ //// return data_slab::to_chunk(); diff --git a/include/bitcoin/system/impl/data/data_slice.ipp b/include/bitcoin/system/impl/data/data_slice.ipp index 00c52ee217..f852e9b750 100644 --- a/include/bitcoin/system/impl/data/data_slice.ipp +++ b/include/bitcoin/system/impl/data/data_slice.ipp @@ -48,7 +48,7 @@ constexpr data_slice::data_slice(const std_array& data) NOEXCEPT // std_vector.begin not constexpr (need full C++20). template > -VCONSTEXPR data_slice::data_slice(const std_vector& data) NOEXCEPT +constexpr data_slice::data_slice(const std_vector& data) NOEXCEPT : data_slice(from_size_(data.begin(), data.size())) { } @@ -72,12 +72,12 @@ constexpr data_slice::data_slice() NOEXCEPT } // std::string.begin not constexpr (need full C++20). -SCONSTEXPR data_slice::data_slice(const std::string& text) NOEXCEPT +constexpr data_slice::data_slice(const std::string& text) NOEXCEPT : data_slice(from_size_(text.begin(), text.size())) { } -SVCONSTEXPR data_slice::data_slice( +constexpr data_slice::data_slice( std::initializer_list bytes) NOEXCEPT : data_slice(from_size_(bytes.begin(), bytes.size())) { @@ -147,7 +147,7 @@ constexpr data_slice data_slice::from_size(Pointer begin, // static template -SVCONSTEXPR data_slice data_slice::from_size_(Pointer begin, +constexpr data_slice data_slice::from_size_(Pointer begin, size_type size) NOEXCEPT { return from_size(begin, size); @@ -179,7 +179,7 @@ to_chunk() const NOEXCEPT return { begin_, end_ }; } -SCONSTEXPR std::string data_slice::to_string() const NOEXCEPT +constexpr std::string data_slice::to_string() const NOEXCEPT { return { begin_, end_ }; } @@ -248,7 +248,7 @@ constexpr bool data_slice::empty() const NOEXCEPT ////} //// //// -////VCONSTEXPR data_slice:: +////constexpr data_slice:: ////operator std_vector() const NOEXCEPT ////{ //// return data_slice::to_chunk(); diff --git a/include/bitcoin/system/impl/endian/integers.ipp b/include/bitcoin/system/impl/endian/integers.ipp index d337c61c4b..39c7eb6621 100644 --- a/include/bitcoin/system/impl/endian/integers.ipp +++ b/include/bitcoin/system/impl/endian/integers.ipp @@ -142,7 +142,7 @@ constexpr Integer from_big_array(size_t length, } template > -VCONSTEXPR Integer from_big_chunk(size_t length, +constexpr Integer from_big_chunk(size_t length, const data_chunk& data) NOEXCEPT { if constexpr (is_one(sizeof(Integer))) @@ -213,7 +213,7 @@ constexpr Integer from_little_array(size_t length, } template > -VCONSTEXPR Integer from_little_chunk(size_t length, +constexpr Integer from_little_chunk(size_t length, const data_chunk& data) NOEXCEPT { if constexpr (is_one(sizeof(Integer))) diff --git a/include/bitcoin/system/impl/endian/nominal.ipp b/include/bitcoin/system/impl/endian/nominal.ipp index 6c50f5ff15..c843092497 100644 --- a/include/bitcoin/system/impl/endian/nominal.ipp +++ b/include/bitcoin/system/impl/endian/nominal.ipp @@ -116,14 +116,14 @@ constexpr Integral from_little_endian(const data_array& data) NOEXCEPT template > -VCONSTEXPR Integral from_big_endian(const data_chunk& data) NOEXCEPT +constexpr Integral from_big_endian(const data_chunk& data) NOEXCEPT { return from_big_chunk(sizeof(Integral), data); } template > -VCONSTEXPR Integral from_little_endian(const data_chunk& data) NOEXCEPT +constexpr Integral from_little_endian(const data_chunk& data) NOEXCEPT { return from_little_chunk(sizeof(Integral), data); } diff --git a/include/bitcoin/system/impl/endian/uintx_t.ipp b/include/bitcoin/system/impl/endian/uintx_t.ipp index d9e80d2f08..da4c901068 100644 --- a/include/bitcoin/system/impl/endian/uintx_t.ipp +++ b/include/bitcoin/system/impl/endian/uintx_t.ipp @@ -62,14 +62,14 @@ constexpr uintx_t uintx_from_little_endian_array( } template -VCONSTEXPR uintx_t uintx_from_big_endian_chunk( +constexpr uintx_t uintx_from_big_endian_chunk( const data_chunk& data) NOEXCEPT { return from_big_chunk>(Size, data); } template -VCONSTEXPR uintx_t uintx_from_little_endian_chunk( +constexpr uintx_t uintx_from_little_endian_chunk( const data_chunk& data) NOEXCEPT { return from_little_chunk>(Size, data); diff --git a/include/bitcoin/system/impl/hash/sha/algorithm_merkle.ipp b/include/bitcoin/system/impl/hash/sha/algorithm_merkle.ipp index 6df45eee13..720efe6f24 100644 --- a/include/bitcoin/system/impl/hash/sha/algorithm_merkle.ipp +++ b/include/bitcoin/system/impl/hash/sha/algorithm_merkle.ipp @@ -332,7 +332,7 @@ xoutput(idigests_t& digests, const xstate_t& xstate) NOEXCEPT // protected TEMPLATE -VCONSTEXPR void CLASS:: +constexpr void CLASS:: merkle_hash_(digests_t& digests, size_t offset) NOEXCEPT { const auto blocks = to_half(digests.size()); @@ -430,7 +430,7 @@ merkle_hash_vector(digests_t& digests) NOEXCEPT // converting input/output (nop) functions. TEMPLATE -VCONSTEXPR typename CLASS::digest_t CLASS:: +constexpr typename CLASS::digest_t CLASS:: merkle_root(digests_t&& digests) NOEXCEPT { static_assert(is_same_type); @@ -450,20 +450,16 @@ merkle_root(digests_t&& digests) NOEXCEPT } TEMPLATE -VCONSTEXPR typename CLASS::digests_t& CLASS:: +constexpr typename CLASS::digests_t& CLASS:: merkle_hash(digests_t& digests) NOEXCEPT { static_assert(is_same_type); -// Avoid tautological warning (std::is_constant_evaluated() always false). -#if defined(HAVE_VECTOR_CONSTEXPR) if (std::is_constant_evaluated()) { merkle_hash_(digests); } - else -#endif - if constexpr (vector) + else if constexpr (vector) { // Merkle block vectorization is applied at 16/8/4 lanes (as available) // and falls back to native/normal (as available) for 3/2/1 lanes. diff --git a/include/bitcoin/system/impl/radix/base_16.ipp b/include/bitcoin/system/impl/radix/base_16.ipp index b2f5c60b3f..84e1a7d526 100644 --- a/include/bitcoin/system/impl/radix/base_16.ipp +++ b/include/bitcoin/system/impl/radix/base_16.ipp @@ -94,7 +94,7 @@ constexpr uint8_t encode_octet( // Encoding of data_slice to hex string. // ---------------------------------------------------------------------------- -SCONSTEXPR std::string encode_base16(const data_slice& data) NOEXCEPT +constexpr std::string encode_base16(const data_slice& data) NOEXCEPT { std::string out; out.resize(data.size() * octet_width); @@ -109,14 +109,13 @@ SCONSTEXPR std::string encode_base16(const data_slice& data) NOEXCEPT return out; } -// std::string is SCONSTEXPR -SRCONSTEXPR std::string encode_hash(const data_slice& hash) NOEXCEPT +// std::string is constexpr +constexpr std::string encode_hash(const data_slice& hash) NOEXCEPT { std::string out; out.resize(hash.size() * octet_width); auto digit = out.begin(); - // views_reverse is RCONSTEXPR for (const auto byte: std::views::reverse(hash)) { *digit++ = to_base16_character(shift_right(byte, to_half(byte_bits))); @@ -129,7 +128,7 @@ SRCONSTEXPR std::string encode_hash(const data_slice& hash) NOEXCEPT // Decoding of hex string to data_array or data_chunk. // ---------------------------------------------------------------------------- -VCONSTEXPR bool decode_base16(data_chunk& out, +constexpr bool decode_base16(data_chunk& out, const std::string& in) NOEXCEPT { if (!is_multiple(in.size(), octet_width)) @@ -199,7 +198,7 @@ constexpr bool decode_hash(data_array& out, // ---------------------------------------------------------------------------- template > -SVCONSTEXPR std::string base16_string(const char(&string)[Size]) NOEXCEPT +constexpr std::string base16_string(const char(&string)[Size]) NOEXCEPT { return to_string(base16_chunk(string)); } diff --git a/include/bitcoin/system/machine/number.hpp b/include/bitcoin/system/machine/number.hpp index 9d3e6f32bd..4d0892d6bd 100644 --- a/include/bitcoin/system/machine/number.hpp +++ b/include/bitcoin/system/machine/number.hpp @@ -29,7 +29,7 @@ namespace machine { namespace number { // Size constraint guards from_little_endian. -// data_chunk methods are VCONSTEXPR but cannot also be INLINE (priority). +// data_chunk methods are constexpr but cannot also be INLINE (priority). template = true> class integer diff --git a/include/bitcoin/system/preprocessor.hpp b/include/bitcoin/system/preprocessor.hpp index b96f2670b4..f3808b8bca 100644 --- a/include/bitcoin/system/preprocessor.hpp +++ b/include/bitcoin/system/preprocessor.hpp @@ -113,8 +113,6 @@ /// A stronger compiler hint for inlining. /// May use prior to 'constexpr' or in place of 'inline'. -/// Do not use in conjunction with with XCONSTEXPR macros, as this will result -/// in a double inline specification in the case of XCONSTEXPR default. /// Disable msc/x32 due to high level of rejection (warning volume). #if defined(HAVE_MSC) && !defined(HAVE_X32) #define INLINE __forceinline @@ -228,39 +226,4 @@ #define CONSTEVAL constexpr #endif -/// C++20 (partial) -#if defined(HAVE_RANGES) - #define RCONSTEXPR constexpr -#else - #define RCONSTEXPR inline -#endif - -/// C++20 (partial) -#if defined(HAVE_VECTOR_CONSTEXPR) - #define VCONSTEXPR constexpr -#else - #define VCONSTEXPR inline -#endif - -/// C++20 (partial) -#if defined(HAVE_STRING_CONSTEXPR) - #define SCONSTEXPR constexpr -#else - #define SCONSTEXPR inline -#endif - -/// C++20 (partial) -#if defined(HAVE_STRING_CONSTEXPR) && defined(HAVE_RANGES) - #define SRCONSTEXPR constexpr -#else - #define SRCONSTEXPR inline -#endif - -/// C++20 (partial) -#if defined(HAVE_STRING_CONSTEXPR) && defined(HAVE_VECTOR_CONSTEXPR) - #define SVCONSTEXPR constexpr -#else - #define SVCONSTEXPR inline -#endif - #endif diff --git a/include/bitcoin/system/radix/base_16.hpp b/include/bitcoin/system/radix/base_16.hpp index 45f10e929a..03e58f565f 100644 --- a/include/bitcoin/system/radix/base_16.hpp +++ b/include/bitcoin/system/radix/base_16.hpp @@ -46,17 +46,17 @@ constexpr uint8_t encode_octet(const char(&string)[add1(octet_width)]) NOEXCEPT; /// --------------------------------------------------------------------------- /// Convert a byte vector to a hexidecimal string. -SCONSTEXPR std::string encode_base16(const data_slice& data) NOEXCEPT; +constexpr std::string encode_base16(const data_slice& data) NOEXCEPT; /// Convert a byte array to a reversed byte order hexidecimal string. -SRCONSTEXPR std::string encode_hash(const data_slice& hash) NOEXCEPT; +constexpr std::string encode_hash(const data_slice& hash) NOEXCEPT; /// Decoding of hex string to data_array or data_chunk. /// --------------------------------------------------------------------------- /// Convert a hexidecimal string to a byte vector. /// False if the input is malformed. -VCONSTEXPR bool decode_base16(data_chunk& out, const std::string& in) NOEXCEPT; +constexpr bool decode_base16(data_chunk& out, const std::string& in) NOEXCEPT; /// Convert a hexidecimal string to a byte array. /// False if the input is malformed, or the wrong length. @@ -76,7 +76,7 @@ constexpr bool decode_hash(data_array& out, /// Convert a literal hex string to a string (bytes are cast to string chars). /// Empty string returned if decoding fails. template = true> -SVCONSTEXPR std::string base16_string(const char(&string)[Size]) NOEXCEPT; +constexpr std::string base16_string(const char(&string)[Size]) NOEXCEPT; /// Convert a literal hexidecimal string literal to pmr vector (not constexpr). /// Empty chunk returned if decoding fails. diff --git a/src/define.cpp b/src/define.cpp index 40e097b77d..b56ccb725e 100644 --- a/src/define.cpp +++ b/src/define.cpp @@ -190,15 +190,6 @@ DEFINED("HAVE_CPP20") #ifdef HAVE_CONSTEVAL DEFINED("HAVE_CONSTEVAL") #endif -#ifdef HAVE_RANGES -DEFINED("HAVE_RANGES") -#endif -#ifdef HAVE_VECTOR_CONSTEXPR -DEFINED("HAVE_VECTOR_CONSTEXPR") -#endif -#ifdef HAVE_STRING_CONSTEXPR -DEFINED("HAVE_STRING_CONSTEXPR") -#endif #ifdef HAVE_EXECUTION DEFINED("HAVE_EXECUTION") diff --git a/test/data/data_slice.cpp b/test/data/data_slice.cpp index 9e8ef0e610..7b4b7bfe1d 100644 --- a/test/data/data_slice.cpp +++ b/test/data/data_slice.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(data_slice__construct__default__empty) static_assert(is_null(data_array<0>{}.data())); BOOST_REQUIRE(is_null(data_chunk{}.data())); - // requires VCONSTEXPR. + // requires constexpr. ////static_assert(is_null(data_chunk{}.data())); data_slice slice{}; diff --git a/test/endian/uintx_t.cpp b/test/endian/uintx_t.cpp index 2390e01dac..59a854ed43 100644 --- a/test/endian/uintx_t.cpp +++ b/test/endian/uintx_t.cpp @@ -28,8 +28,12 @@ BOOST_AUTO_TEST_CASE(endian__to_array__zero__expected) { static_assert(from_uintx(uint5_t{ 1 }) == data_array<1>{ 1 }); static_assert(from_uintx(uint11_t{ 1 }) == data_array<2>{ 1 }); - // Internal compiler error msvc++. - ////static_assert(from_uintx(uint48_t{ 1 }) == data_array<6>{ 1 }); + + // MSVC internal compiler error. + #if !defined(HAVE_MSC) + static_assert(from_uintx(uint48_t{ 1 }) == data_array<6>{ 1 }); + #endif + static_assert(from_uintx(uint128_t{ 1 }) == data_array<16>{ 1 }); static_assert(from_uintx(uint160_t{ 1 }) == data_array<20>{ 1 }); static_assert(from_uintx(uint256_t{ 1 }) == data_array<32>{ 1 }); diff --git a/test/hash/sha/sha256.cpp b/test/hash/sha/sha256.cpp index c8c3a50368..c658782d11 100644 --- a/test/hash/sha/sha256.cpp +++ b/test/hash/sha/sha256.cpp @@ -233,9 +233,7 @@ BOOST_AUTO_TEST_CASE(sha256__double_hash__half_blocks__expected) BOOST_AUTO_TEST_CASE(sha256__merkle_hash__two__expected) { constexpr auto expected = sha256::double_hash({ 0 }, { 1 }); -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(merkle_hash(expected)); -#endif sha256::digests_t digests{ { 0 }, { 1 } }; sha256::merkle_hash(digests); BOOST_CHECK_EQUAL(digests.size(), one); @@ -246,9 +244,7 @@ BOOST_AUTO_TEST_CASE(sha256__merkle_hash__four__expected) { constexpr auto expected1 = sha256::double_hash({ 0 }, { 1 }); constexpr auto expected2 = sha256::double_hash({ 2 }, { 3 }); -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(merkle_hash(expected1, expected2)); -#endif sha256::digests_t digests{ { 0 }, { 1 }, { 2 }, { 3 } }; sha256::merkle_hash(digests); BOOST_CHECK_EQUAL(digests.size(), two); @@ -260,32 +256,26 @@ BOOST_AUTO_TEST_CASE(sha256__merkle_hash__four__expected) BOOST_AUTO_TEST_CASE(sha256__merkle_root__empty__null_hash) { constexpr auto expected = null_hash; -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(sha256::merkle_root({}) == expected); -#endif BOOST_CHECK_EQUAL(sha256::merkle_root({}), expected); } BOOST_AUTO_TEST_CASE(sha256__merkle_root__one__same) { constexpr auto expected = sha256::digest_t{ 42 }; -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(sha256::merkle_root({ { 42 } }) == expected); -#endif BOOST_CHECK_EQUAL(sha256::merkle_root({ { 42 } }), expected); } BOOST_AUTO_TEST_CASE(sha256__merkle_root__two__expected) { constexpr auto expected = sha256::double_hash({ 0 }, { 1 }); -#if defined (HAVE_VECTOR_CONSTEXPR) // MSVC Debug build internal compiler error. #if !(defined(HAVE_MSC) && !defined(NDEBUG)) - static_assert(sha256::merkle_root({ { 0 }, { 1 } }) == expected); + static_assert(sha256::merkle_root({ { 0 }, { 1 } }) == expected); #endif -#endif BOOST_CHECK_EQUAL(sha256::merkle_root({ { 0 }, { 1 } }), expected); } @@ -294,9 +284,7 @@ BOOST_AUTO_TEST_CASE(sha256__merkle_root__three__expected) constexpr auto expected1 = sha256::double_hash({ 0 }, { 1 }); constexpr auto expected2 = sha256::double_hash({ 2 }, { 2 }); constexpr auto expected = sha256::double_hash(expected1, expected2); -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(sha256::merkle_root({ { 0 }, { 1 }, { 2 } }) == expected); -#endif BOOST_CHECK_EQUAL(sha256::merkle_root({ { 0 }, { 1 }, { 2 } }), expected); } @@ -305,9 +293,7 @@ BOOST_AUTO_TEST_CASE(sha256__merkle_root__four__expected) constexpr auto expected1 = sha256::double_hash({ 0 }, { 1 }); constexpr auto expected2 = sha256::double_hash({ 2 }, { 3 }); constexpr auto expected = sha256::double_hash(expected1, expected2); -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(sha256::merkle_root({ { 0 }, { 1 }, { 2 }, { 3 } }) == expected); -#endif BOOST_CHECK_EQUAL(sha256::merkle_root({ { 0 }, { 1 }, { 2 }, { 3 } }), expected); } diff --git a/test/hash/sha/sha512.cpp b/test/hash/sha/sha512.cpp index e355287a47..6cf6311c6a 100644 --- a/test/hash/sha/sha512.cpp +++ b/test/hash/sha/sha512.cpp @@ -295,9 +295,7 @@ BOOST_AUTO_TEST_CASE(sha512__double_hash__half_blocks__expected) BOOST_AUTO_TEST_CASE(sha512__merkle_hash__two__expected) { constexpr auto expected = sha512::double_hash({ 0 }, { 1 }); -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(merkle_hash(expected)); -#endif sha512::digests_t digests{ { 0 }, { 1 } }; sha512::merkle_hash(digests); BOOST_CHECK_EQUAL(digests.size(), one); @@ -308,9 +306,7 @@ BOOST_AUTO_TEST_CASE(sha512__merkle_hash__four__expected) { constexpr auto expected1 = sha512::double_hash({ 0 }, { 1 }); constexpr auto expected2 = sha512::double_hash({ 2 }, { 3 }); -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(merkle_hash(expected1, expected2)); -#endif sha512::digests_t digests{ { 0 }, { 1 }, { 2 }, { 3 } }; sha512::merkle_hash(digests); BOOST_CHECK_EQUAL(digests.size(), two); @@ -322,32 +318,26 @@ BOOST_AUTO_TEST_CASE(sha512__merkle_hash__four__expected) BOOST_AUTO_TEST_CASE(sha512__merkle_root__empty__null_long_hash) { constexpr auto expected = null_long_hash; -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(sha512::merkle_root({}) == expected); -#endif BOOST_CHECK_EQUAL(sha512::merkle_root({}), expected); } BOOST_AUTO_TEST_CASE(sha512__merkle_root__one__same) { constexpr auto expected = sha512::digest_t{ 42 }; -#if defined (HAVE_VECTOR_CONSTEXPR) static_assert(sha512::merkle_root({ { 42 } }) == expected); -#endif BOOST_CHECK_EQUAL(sha512::merkle_root({ { 42 } }), expected); } BOOST_AUTO_TEST_CASE(sha512__merkle_root__two__expected) { constexpr auto expected = sha512::double_hash({ 0 }, { 1 }); -#if defined (HAVE_VECTOR_CONSTEXPR) // MSVC Debug build internal compiler error. #if !(defined(HAVE_MSC) && !defined(NDEBUG)) - static_assert(sha512::merkle_root({ { 0 }, { 1 } }) == expected); + static_assert(sha512::merkle_root({ { 0 }, { 1 } }) == expected); #endif -#endif BOOST_CHECK_EQUAL(sha512::merkle_root({ { 0 }, { 1 } }), expected); } @@ -356,10 +346,7 @@ BOOST_AUTO_TEST_CASE(sha512__merkle_root__three__expected) constexpr auto expected1 = sha512::double_hash({ 0 }, { 1 }); constexpr auto expected2 = sha512::double_hash({ 2 }, { 2 }); constexpr auto expected = sha512::double_hash(expected1, expected2); -// Internal compiler error vc++. -////#if defined (HAVE_VECTOR_CONSTEXPR) -//// static_assert(sha512::merkle_root({ { 0 }, { 1 }, { 2 } }) == expected); -////#endif + static_assert(sha512::merkle_root({ { 0 }, { 1 }, { 2 } }) == expected); BOOST_CHECK_EQUAL(sha512::merkle_root({ { 0 }, { 1 }, { 2 } }), expected); } @@ -368,14 +355,12 @@ BOOST_AUTO_TEST_CASE(sha512__merkle_root__four__expected) constexpr auto expected1 = sha512::double_hash({ 0 }, { 1 }); constexpr auto expected2 = sha512::double_hash({ 2 }, { 3 }); constexpr auto expected = sha512::double_hash(expected1, expected2); -#if defined (HAVE_VECTOR_CONSTEXPR) // MSVC Debug build internal compiler error. #if !(defined(HAVE_MSC) && !defined(NDEBUG)) - static_assert(sha512::merkle_root({ { 0 }, { 1 }, { 2 }, { 3 } }) == expected); + static_assert(sha512::merkle_root({ { 0 }, { 1 }, { 2 }, { 3 } }) == expected); #endif -#endif BOOST_CHECK_EQUAL(sha512::merkle_root({ { 0 }, { 1 }, { 2 }, { 3 } }), expected); } diff --git a/test/hash/sha/vector.cpp b/test/hash/sha/vector.cpp index f1de3ed4e3..1c68acfb2a 100644 --- a/test/hash/sha/vector.cpp +++ b/test/hash/sha/vector.cpp @@ -20,8 +20,6 @@ BOOST_AUTO_TEST_SUITE(vector_tests) -#if defined(HAVE_VECTOR_CONSTEXPR) - // Merkle root // ---------------------------------------------------------------------------- @@ -184,6 +182,4 @@ BOOST_AUTO_TEST_CASE(vector__sha512__scheduling__expected) BOOST_CHECK_EQUAL(hashn, sha512v::hash(blocks)); } -#endif - BOOST_AUTO_TEST_SUITE_END()