diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-27 05:10:30 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-27 18:32:19 +0800 |
commit | 204214f0700179e3d8fa97c77d4f92acd349f015 (patch) | |
tree | 26838663fe5b2a890eceee50434db778c802ca13 /libsolidity/codegen/CompilerUtils.h | |
parent | a657d3b1a165d9ec14f9875db2380954f9ca37cf (diff) | |
download | dexon-solidity-204214f0700179e3d8fa97c77d4f92acd349f015.tar.gz dexon-solidity-204214f0700179e3d8fa97c77d4f92acd349f015.tar.zst dexon-solidity-204214f0700179e3d8fa97c77d4f92acd349f015.zip |
Split encodeToMemory to packedEncode and abiEncode
Diffstat (limited to 'libsolidity/codegen/CompilerUtils.h')
-rw-r--r-- | libsolidity/codegen/CompilerUtils.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/libsolidity/codegen/CompilerUtils.h b/libsolidity/codegen/CompilerUtils.h index b239bde6..ad3989ad 100644 --- a/libsolidity/codegen/CompilerUtils.h +++ b/libsolidity/codegen/CompilerUtils.h @@ -109,6 +109,19 @@ public: bool _encodeAsLibraryTypes = false ); + /// Special case of @a encodeToMemory which assumes tight packing, e.g. no zero padding + /// and dynamic data is encoded in-place. + /// Stack pre: <value0> <value1> ... <valueN-1> <head_start> + /// Stack post: <mem_ptr> + void packedEncode( + TypePointers const& _givenTypes, + TypePointers const& _targetTypes, + bool _encodeAsLibraryTypes = false + ) + { + encodeToMemory(_givenTypes, _targetTypes, false, true, _encodeAsLibraryTypes); + } + /// Special case of @a encodeToMemory which assumes that everything is padded to words /// and dynamic data is not copied in place (i.e. a proper ABI encoding). /// Stack pre: <value0> <value1> ... <valueN-1> <head_start> @@ -117,6 +130,20 @@ public: TypePointers const& _givenTypes, TypePointers const& _targetTypes, bool _encodeAsLibraryTypes = false + ) + { + encodeToMemory(_givenTypes, _targetTypes, true, false, _encodeAsLibraryTypes); + } + + /// Special case of @a encodeToMemory which assumes that everything is padded to words + /// and dynamic data is not copied in place (i.e. a proper ABI encoding). + /// Uses a new, less tested encoder implementation. + /// Stack pre: <value0> <value1> ... <valueN-1> <head_start> + /// Stack post: <mem_ptr> + void abiEncodeV2( + TypePointers const& _givenTypes, + TypePointers const& _targetTypes, + bool _encodeAsLibraryTypes = false ); /// Zero-initialises (the data part of) an already allocated memory array. |