@@ -38,28 +38,32 @@ else:
3838 {.hint : " nimcrypto SHA256 backend enabled" .}
3939 type DigestCtx * = sha2.sha256
4040
41- when PREFER_HASHTREE_SHA256 and (defined (arm64) or defined (amd64)) and (
41+ const HASHTREE_SUPPORTED * = (defined (arm64) or defined (amd64)) and (
4242 (defined (linux) and defined (gcc)) or
4343 # llvm-mingw doesn't support hashtree well even with "-fno-integrated-as"
4444 # this is true with clang-17(19th June 2024).
4545 (defined (windows) and defined (gcc) and " clang" notin staticExec (" gcc --version" )) or
4646 (defined (linux) and defined (clang)) or
4747 (defined (macosx) and defined (clang) and defined (arm64))
48- ):
48+ )
49+ when PREFER_HASHTREE_SHA256 and HASHTREE_SUPPORTED :
4950 {.hint : " Hashtree SHA256 backend enabled" .}
5051 when tryImport ../ vendor/ hashtree/ hashtree_abi:
5152 {.hint : " hashtree_abi found in vendor" .}
52- const USE_HASHTREE_SHA256 = true
53- # import hashtree_abi from vendor
53+ const HASHTREE_ABI_FOUND = true
5454 elif tryImport hashtree_abi:
5555 {.hint : " hashtree_abi package found" .}
56- const USE_HASHTREE_SHA256 = true
57- # import hashtree_abi as a package
56+ const HASHTREE_ABI_FOUND = true
5857 else :
5958 {.hint : " hashtree_abi not found, disabling hashtree backend" .}
60- const USE_HASHTREE_SHA256 = false
59+ const HASHTREE_ABI_FOUND = false
6160else :
62- const USE_HASHTREE_SHA256 = false
61+ const HASHTREE_ABI_FOUND = false
62+
63+ const USE_HASHTREE_SHA256 * =
64+ PREFER_HASHTREE_SHA256 and HASHTREE_SUPPORTED and HASHTREE_ABI_FOUND
65+
66+
6367
6468template computeDigest * (body: untyped ): Digest =
6569 # # This little helper will init the hash function and return the sliced
0 commit comments