EVM-C: Simplify evm_hash256 struct

This commit is contained in:
Paweł Bylica 2016-08-28 20:40:20 +02:00
parent 80581b3df7
commit 0b9b01e05c
2 changed files with 6 additions and 7 deletions

View File

@ -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}};

View File

@ -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.