Skip to content

Commit 74d2143

Browse files
authored
test: Use std::bit_cast (#712)
1 parent 65d4b10 commit 74d2143

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

test/state/hash_utils.hpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <ethash/keccak.hpp>
88
#include <evmc/evmc.hpp>
99
#include <evmc/hex.hpp>
10-
#include <cstring>
10+
#include <bit>
1111

1212
namespace evmone
1313
{
@@ -29,10 +29,7 @@ static constexpr auto EmptyListHash =
2929
/// Computes Keccak hash out of input bytes (wrapper of ethash::keccak256).
3030
inline hash256 keccak256(bytes_view data) noexcept
3131
{
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;
32+
return std::bit_cast<hash256>(ethash::keccak256(data.data(), data.size()));
3633
}
3734
} // namespace evmone
3835

0 commit comments

Comments
 (0)