abdk-libraries-solidity
abdk-libraries-solidity copied to clipboard
Incorrect hardcoded value of 0x8 in sqrtu function (should be 0x4)
The hardcoded value here is wrong.
0x8 = 1<<3 but it should be 1<<2 i.e. 0x4
I'm not sure how smart solc is (whether it will unroll loops if one cranks the optimization runs sufficiently high - I haven't tried it yet), but all of this could be avoided by
using the 1 << shift syntax
writing the entire thing as a loop (same with the 7x code repetition below)
@nonergodic Can you provide an input and an expected output for which the hardcoded value would create problems?