Increased clarity of assembly statement

This commit is contained in:
Denton Liu 2016-05-11 15:54:45 -04:00
parent 14bd009eb6
commit d6f05a6d36

View File

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