diff --git a/src/jug.sol b/src/jug.sol index 3d4e7207..fc45e07a 100644 --- a/src/jug.sol +++ b/src/jug.sol @@ -47,7 +47,7 @@ contract Jug is DSNote { let half := div(b, 2) // for rounding. for { n := div(n, 2) } n { n := div(n,2) } { let xx := mul(x, x) - if iszero(eq(div(xx, x), x)) { revert(0,0) } + if shr(128, x) { revert(0,0) } let xxRound := add(xx, half) if lt(xxRound, xx) { revert(0,0) } x := div(xxRound, b) diff --git a/src/pot.sol b/src/pot.sol index 3df066ea..4b070f1a 100644 --- a/src/pot.sol +++ b/src/pot.sol @@ -85,7 +85,7 @@ contract Pot is DSNote { let half := div(base, 2) // for rounding. for { n := div(n, 2) } n { n := div(n,2) } { let xx := mul(x, x) - if iszero(eq(div(xx, x), x)) { revert(0,0) } + if shr(128, x) { revert(0,0) } let xxRound := add(xx, half) if lt(xxRound, xx) { revert(0,0) } x := div(xxRound, base)