File tree Expand file tree Collapse file tree
include/bitcoin/system/impl/hash/sha Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -404,9 +404,18 @@ merkle_hash_vector(digests_t& digests) NOEXCEPT
404404 // Merkle hash vector dispatch.
405405 if constexpr (use_x512)
406406 merkle_hash_vector<xint512_t >(idigests, iblocks);
407+
408+ // Use if shani is not available or at least 32 blocks.
407409 if constexpr (use_x256)
408- merkle_hash_vector<xint256_t >(idigests, iblocks);
409- if constexpr (use_x128)
410+ {
411+ if constexpr (!native)
412+ merkle_hash_vector<xint256_t >(idigests, iblocks);
413+ else if (start >= 32_size)
414+ merkle_hash_vector<xint256_t >(idigests, iblocks);
415+ }
416+
417+ // Only use if shani is not available.
418+ if constexpr (use_x128 && !native)
410419 merkle_hash_vector<xint128_t >(idigests, iblocks);
411420
412421 // iblocks.size() is reduced by vectorization.
@@ -461,7 +470,6 @@ merkle_hash(digests_t& digests) NOEXCEPT
461470#endif
462471 if constexpr (vector)
463472 {
464- // TODO: test vector vs. native performance for the 4 lane scenario.
465473 // Merkle block vectorization is applied at 16/8/4 lanes (as available)
466474 // and falls back to native/normal (as available) for 3/2/1 lanes.
467475 merkle_hash_vector (digests);
You can’t perform that action at this time.
0 commit comments