Fixes for failing tests

This commit is contained in:
Jim McDonald 2017-12-13 07:55:46 +00:00
parent 6e521d59b0
commit 93cf4dee66
4 changed files with 8 additions and 8 deletions

View File

@ -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. // 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 // 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) public { function sumAsm(uint[] _data) public returns (uint o_sum) {
for (uint i = 0; i < _data.length; ++i) { for (uint i = 0; i < _data.length; ++i) {
assembly { assembly {
o_sum := add(o_sum, mload(add(add(_data, 0x20), mul(i, 0x20)))) 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. // Same as above, but accomplish the entire code within inline assembly.
function sumPureAsm(uint[] _data) returns (uint o_sum) public { function sumPureAsm(uint[] _data) public returns (uint o_sum) {
assembly { assembly {
// Load the length (first 32 bytes) // Load the length (first 32 bytes)
let len := mload(_data) let len := mload(_data)

View File

@ -135,7 +135,7 @@ the gas can be specified with special options ``.value()`` and ``.gas()``, respe
contract Consumer { contract Consumer {
InfoFeed feed; InfoFeed feed;
function setFeed(address addr) public { feed = InfoFeed(addr); } function setFeed(address addr) public { feed = InfoFeed(addr); }
function public callFeed() { feed.info.value(10).gas(800)(); } function callFeed() public { feed.info.value(10).gas(800)(); }
} }
The modifier ``payable`` has to be used for ``info``, because otherwise, the `.value()` The modifier ``payable`` has to be used for ``info``, because otherwise, the `.value()`

View File

@ -158,9 +158,9 @@ of votes.
returns (uint winningProposal) returns (uint winningProposal)
{ {
uint winningVoteCount = 0; uint winningVoteCount = 0;
for (uint p = 0; p < winningProposals.length; p++) { for (uint p = 0; p < proposals.length; p++) {
if (winningProposals[p].voteCount > winningVoteCount) { if (proposals[p].voteCount > winningVoteCount) {
winningVoteCount = winningProposals[p].voteCount; winningVoteCount = proposals[p].voteCount;
winningProposal = p; winningProposal = p;
} }
} }
@ -172,7 +172,7 @@ of votes.
function winnerName() public view function winnerName() public view
returns (bytes32 winnerName) returns (bytes32 winnerName)
{ {
name = proposals[winningProposal()].name; winnerName = proposals[winningProposal()].name;
} }
} }

View File

@ -649,7 +649,7 @@ assigned to a variable right away.
function f() public pure { function f() public pure {
g([uint(1), 2, 3]); g([uint(1), 2, 3]);
} }
function g(uint[3] _data) public { function g(uint[3] _data) public pure {
// ... // ...
} }
} }