We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65d4b10 commit 74d2143Copy full SHA for 74d2143
test/state/hash_utils.hpp
@@ -7,7 +7,7 @@
7
#include <ethash/keccak.hpp>
8
#include <evmc/evmc.hpp>
9
#include <evmc/hex.hpp>
10
-#include <cstring>
+#include <bit>
11
12
namespace evmone
13
{
@@ -29,10 +29,7 @@ static constexpr auto EmptyListHash =
29
/// Computes Keccak hash out of input bytes (wrapper of ethash::keccak256).
30
inline hash256 keccak256(bytes_view data) noexcept
31
32
- const auto eh = ethash::keccak256(data.data(), data.size());
33
- hash256 h;
34
- std::memcpy(h.bytes, eh.bytes, sizeof(h)); // TODO: Use std::bit_cast.
35
- return h;
+ return std::bit_cast<hash256>(ethash::keccak256(data.data(), data.size()));
36
}
37
} // namespace evmone
38
0 commit comments