Skip to content

Commit bf12bb8

Browse files
committed
Comments
1 parent e5d4347 commit bf12bb8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils/512Math.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ library Lib512MathArithmetic {
18601860

18611861
// We treat `r` as a ≤2-limb bigint where each limb is half a machine word (128 bits).
18621862
// Spliting √x in this way lets us apply "ordinary" 256-bit `sqrt` to the top word of
1863-
// `x`. Then we can recover the bottom limb or `r` without 512-bit division.
1863+
// `x`. Then we can recover the bottom limb of `r` without 512-bit division.
18641864
//
18651865
// Implementing this as:
18661866
// uint256 r_hi = x_hi.sqrt();
@@ -1898,8 +1898,8 @@ library Lib512MathArithmetic {
18981898
let d := shl(0x01, r_hi)
18991899
r_lo := div(n, d)
19001900

1901-
// It's possible that `n` was 257 bits and overflowed. Explicitly handling the carry
1902-
// avoids 512-bit division.
1901+
// It's possible that `n` was 257 bits and overflowed (`res` was not just a single
1902+
// limb). Explicitly handling the carry avoids 512-bit division.
19031903
let c := shr(0x80, res)
19041904
let neg_c := sub(0x00, c)
19051905
res := mod(n, d)

0 commit comments

Comments
 (0)