Skip to content

Instantly share code, notes, and snippets.

View marmitar's full-sized avatar

Tiago de Paula marmitar

View GitHub Profile
// Efficient SQRT method
// Constant gas cost of 331 discounting RETURN and CALLDATALOAD logic, or 349 including everything.
//
// Special thanks to @caironeth for have found a better log2(x) here:
// - https://github.com/Lohann/openzeppelin-contracts/pull/1
//
// For testing use this tool: https://www.evm.codes/playground?fork=cancun
// Authors:
// - Lohann Paterno Coutinho Ferreira <[email protected]>
// - Cairo <https://github.com/cairoeth>