File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ library CurveLib {
51
51
uint256 C;
52
52
uint256 fourAC;
53
53
unchecked {
54
- B = int256 ((py * (y - y0) + (px - 1 )) / px) - (2 * int256 (c) - int256 (1e18 )) * int256 (x0) / 1e18 ;
54
+ B = int256 ((py * (y - y0) + (px - 1 )) / px) - (2 * int256 (c) - int256 (1e18 )) * int256 (x0) / 1e18 ;
55
55
if (x0 >= 1e18 ) {
56
56
// if x0 >= 1, scale as normal
57
57
C = Math.mulDiv ((1e18 - c), x0 * x0, 1e36 , Math.Rounding.Ceil);
@@ -62,7 +62,7 @@ library CurveLib {
62
62
fourAC = Math.mulDiv (4 * c, C, 1e18 , Math.Rounding.Ceil);
63
63
}
64
64
}
65
-
65
+
66
66
uint256 absB = uint256 (B >= 0 ? B : - B);
67
67
uint256 squaredB;
68
68
uint256 discriminant;
@@ -74,7 +74,7 @@ library CurveLib {
74
74
discriminant = squaredB + fourAC; // keep in 1e36 scale for increased precision ahead of sqrt
75
75
sqrt = Math.sqrt (discriminant); // drop back to 1e18 scale
76
76
sqrt = (sqrt * sqrt < discriminant) ? sqrt + 1 : sqrt;
77
- }
77
+ }
78
78
} else {
79
79
// use scaled, overflow-safe path
80
80
uint256 scale = computeScale (absB);
@@ -110,7 +110,7 @@ library CurveLib {
110
110
111
111
// 2^excessBits is how much we need to scale down to prevent overflow when squaring x
112
112
if (bits > 128 ) {
113
- uint256 excessBits = bits - 128 ;
113
+ uint256 excessBits = bits - 128 ;
114
114
scale = 1 << excessBits;
115
115
} else {
116
116
scale = 1 ;
You can’t perform that action at this time.
0 commit comments