Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getData() public view {
- uint length;
- for(uint i = 0; i<6; i++) {
- length += data[i].length;
- }
- bytes memory result = new bytes(length);
- uint index = 32; // bytes is an array, and in EVM the first
- // 32 bytes of an array stores the length
- // of the array, so add data 32 byte in
- for(i = 0; i < 6; i++) {
- bytes memory oneSixth = new bytes(data[i].length);
- oneSixth = data[i];
- assembly {
- mstore(add(result, index), add(oneSixth, 32))
- }
- index += data[i].length;
- }
- }
Add Comment
Please, Sign In to add comment