mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Increased clarity of assembly statement
This commit is contained in:
parent
14bd009eb6
commit
d6f05a6d36
@ -294,8 +294,11 @@ you really know what you are doing.
|
|||||||
// 0x20 needs to be added to an array because the first slot contains the
|
// 0x20 needs to be added to an array because the first slot contains the
|
||||||
// array length.
|
// array length.
|
||||||
function sumAsm(uint[] _data) returns (uint o_sum) {
|
function sumAsm(uint[] _data) returns (uint o_sum) {
|
||||||
for (uint i = 0; i < _data.length; ++i)
|
for (uint i = 0; i < _data.length; ++i) {
|
||||||
assembly { o_sum := mload(add(add(_data, 0x20), i)) }
|
assembly {
|
||||||
|
o_sum := mload(add(add(_data, 0x20), i))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user