diff options
author | Chase McDermott <chasemcd1745@tamu.edu> | 2018-07-15 05:42:01 +0800 |
---|---|---|
committer | Chase McDermott <chasemcd1745@tamu.edu> | 2018-07-15 05:42:43 +0800 |
commit | 3267adcd14ba10e27a4b177e771fca9c9ab39646 (patch) | |
tree | 1c9b69f82d2af0e7eaf56b17188014b541b66ce8 /docs/assembly.rst | |
parent | 31e56f9f9976cee44f000226318dca566f0f0b79 (diff) | |
download | dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.gz dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.bz2 dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.lz dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.xz dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.zst dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.zip |
Added default data locations to docs and other external tests.
Diffstat (limited to 'docs/assembly.rst')
-rw-r--r-- | docs/assembly.rst | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/assembly.rst b/docs/assembly.rst index cf114c12..ec6ac876 100644 --- a/docs/assembly.rst +++ b/docs/assembly.rst @@ -54,7 +54,7 @@ idea is that assembly libraries will be used to enhance the language in such way pragma solidity ^0.4.0; library GetCode { - function at(address _addr) public view returns (bytes o_code) { + function at(address _addr) public view returns (bytes memory o_code) { assembly { // retrieve the size of the code, this needs assembly let size := extcodesize(_addr) @@ -83,7 +83,7 @@ you really know what you are doing. library VectorSum { // This function is less efficient because the optimizer currently fails to // remove the bounds checks in array access. - function sumSolidity(uint[] _data) public view returns (uint o_sum) { + function sumSolidity(uint[] memory _data) public view returns (uint o_sum) { for (uint i = 0; i < _data.length; ++i) o_sum += _data[i]; } @@ -91,7 +91,7 @@ you really know what you are doing. // We know that we only access the array in bounds, so we can avoid the check. // 0x20 needs to be added to an array because the first slot contains the // array length. - function sumAsm(uint[] _data) public view returns (uint o_sum) { + function sumAsm(uint[] memory _data) public view returns (uint o_sum) { for (uint i = 0; i < _data.length; ++i) { assembly { o_sum := add(o_sum, mload(add(add(_data, 0x20), mul(i, 0x20)))) @@ -100,7 +100,7 @@ you really know what you are doing. } // Same as above, but accomplish the entire code within inline assembly. - function sumPureAsm(uint[] _data) public view returns (uint o_sum) { + function sumPureAsm(uint[] memory _data) public view returns (uint o_sum) { assembly { // Load the length (first 32 bytes) let len := mload(_data) |