althea-net / guac

The on chain billing code for Althea
Apache License 2.0
18 stars 7 forks source link

Declaring variable inside for loop #2

Closed janus closed 6 years ago

janus commented 7 years ago

Declaring variable inside for loop looks a bit strange too me. And it may create a lot of memories in the stack uint256 hashedOffset; uint256 preimageOffset; for (uint256 i = 0; i < pairs.length; i += 64) { hashedOffset = i + 32; preimageOffset = i + 64;

        assembly {
            hashed := mload(add(pairs, hashedOffset))
            preimage := mload(add(pairs, preimageOffset))
        }

        submitPreimage(hashed, preimage);
    }

}

jtremback commented 7 years ago

I don't see any variables being declared in the loop.

jtremback commented 7 years ago

Also, read https://guides.github.com/features/mastering-markdown/ to format code samples better