Commit c8e4c555 authored by Daniel Luca's avatar Daniel Luca Committed by GitHub

Optimize loop iterator. (#354)

parent 25a2a575
...@@ -203,7 +203,7 @@ library Lib_MerkleTree { ...@@ -203,7 +203,7 @@ library Lib_MerkleTree {
// Borrowed with <3 from https://github.com/ethereum/solidity-examples // Borrowed with <3 from https://github.com/ethereum/solidity-examples
uint256 val = _in; uint256 val = _in;
uint256 highest = 0; uint256 highest = 0;
for (uint8 i = 128; i >= 1; i >>= 1) { for (uint256 i = 128; i >= 1; i >>= 1) {
if (val & (uint(1) << i) - 1 << i != 0) { if (val & (uint(1) << i) - 1 << i != 0) {
highest += i; highest += i;
val >>= i; val >>= i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment