From 0b9b01e05c9a6761dd061c17147196c627dd66c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Sun, 28 Aug 2016 20:40:20 +0200 Subject: [PATCH] EVM-C: Simplify evm_hash256 struct --- examples/capi.c | 2 +- include/evm.h | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/examples/capi.c b/examples/capi.c index 6bc09f7..5fdb11a 100644 --- a/examples/capi.c +++ b/examples/capi.c @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) { char const code[] = "exec()"; const size_t code_size = sizeof(code); - struct evm_hash256 code_hash = {.words = {1, 2, 3}}; + struct evm_hash256 code_hash = {.bytes = {1, 2, 3,}}; char const input[] = "Hello World!"; struct evm_uint256 value = {{1, 0, 0, 0}}; diff --git a/include/evm.h b/include/evm.h index 67e3e83..598e965 100644 --- a/include/evm.h +++ b/include/evm.h @@ -48,12 +48,11 @@ struct evm_hash160 { /// 32 bytes of data. For EVM that means big-endian 256-bit integer. Values of /// this type are converted to host-endian values inside EVM. struct evm_hash256 { - union { - /// The 32 bytes of the integer/hash. Memory aligned to 8 bytes. - uint8_t bytes[32]; - /// Additional access by uint64 words to enforce 8 bytes alignment. - uint64_t words[4]; - }; + /// The 32 bytes of the integer/hash. + /// + /// The memory is expected be aligned to 8 bytes, but there no protable way + /// to express that. + uint8_t bytes[32]; }; /// The execution result code.