Skip to content

Commit

Permalink
Avoided checked zero subtraction
Browse files Browse the repository at this point in the history
  • Loading branch information
asselstine committed Oct 13, 2021
1 parent 293e224 commit 4e80927
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion contracts/DrawCalculator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,11 @@ contract DrawCalculator is IDrawCalculator, Ownable {

if ((_randomNumberThisPick & mask) != (_winningRandomNumber & mask)) {
// there are no more sequential matches since this comparison is not a match
return masksLength - numberOfMatches;
if (masksLength == numberOfMatches) {
return 0;
} else {
return masksLength - numberOfMatches;
}
}

// else there was a match
Expand Down

0 comments on commit 4e80927

Please sign in to comment.