Closed 0xSumitBanik closed 2 years ago
Please feel free to review the changes. @mkubdev , @wenceslas-sanchez Thanks.
This PR provides the fix for the issue #6
- Fixed the conditional checks for the uint and int type comparison
- Fixed the condition where i should be <= _n
Indeed those are typos :)
- Also saved some gas for the iterative function by using pre-increment operator (++i)
Gas Comparison
Operation Execution Cost i++ 26496 gas ++i 26456 gas
About gas consumption, could you provide an example ? On Remix I tried with severals combinaisons and it results with same gas comsuption.
Yes, I mentioned the execution cost which you see on the Remix console. I got different execution cost for using ++i vs i++ in the loop.
i++
++i
Let me know if I'm still confusing you.
Yes you're right, I was looking at the other method.
- Fixed the conditional checks for the uint and int type comparison
- Fixed the condition where i should be <= _n
Well spotted!
Also saved some gas for the iterative function by using pre-increment operator (++i)
I can reproduce on Remix! Well spotted too.
i++ :
++i :
@wenceslas-sanchez I think you got same results because you forget to update the <=
operators inside the for-loop
Look good to me. @wenceslas-sanchez ?
Yeah that's perfect !
This PR provides the fix for the issue #6
Gas Comparison