| ... | @@ -1130,7 +1130,7 @@ const ct_protected = struct { | ... | @@ -1130,7 +1130,7 @@ const ct_protected = struct { |
| 1130 | fn eql(x: anytype, y: @TypeOf(x)) bool { | 1130 | fn eql(x: anytype, y: @TypeOf(x)) bool { |
| 1131 | const c1 = @subWithOverflow(x, y)[1]; | 1131 | const c1 = @subWithOverflow(x, y)[1]; |
| 1132 | const c2 = @subWithOverflow(y, x)[1]; | 1132 | const c2 = @subWithOverflow(y, x)[1]; |
| 1133 | return @as(bool, @bitCast(1 - (c1 | c2))); | 1133 | return @bitCast(1 - (c1 | c2)); |
| 1134 | } | 1134 | } |
| 1135 | | 1135 | |
| 1136 | // Compares two big integers in constant time, returning true if x < y. | 1136 | // Compares two big integers in constant time, returning true if x < y. |
| ... | @@ -1151,14 +1151,14 @@ const ct_protected = struct { | ... | @@ -1151,14 +1151,14 @@ const ct_protected = struct { |
| 1151 | fn mulWide(x: Limb, y: Limb) WideLimb { | 1151 | fn mulWide(x: Limb, y: Limb) WideLimb { |
| 1152 | const half_bits = @typeInfo(Limb).int.bits / 2; | 1152 | const half_bits = @typeInfo(Limb).int.bits / 2; |
| 1153 | const Half = @Int(.unsigned, half_bits); | 1153 | const Half = @Int(.unsigned, half_bits); |
| 1154 | const x0 = @as(Half, @truncate(x)); | 1154 | const x0: Half = @truncate(x); |
| 1155 | const x1 = @as(Half, @truncate(x >> half_bits)); | 1155 | const x1: Half = @truncate(x >> half_bits); |
| 1156 | const y0 = @as(Half, @truncate(y)); | 1156 | const y0: Half = @truncate(y); |
| 1157 | const y1 = @as(Half, @truncate(y >> half_bits)); | 1157 | const y1: Half = @truncate(y >> half_bits); |
| 1158 | const w0 = math.mulWide(Half, x0, y0); | 1158 | const w0 = math.mulWide(Half, x0, y0); |
| 1159 | const t = math.mulWide(Half, x1, y0) + (w0 >> half_bits); | 1159 | const t = math.mulWide(Half, x1, y0) + (w0 >> half_bits); |
| 1160 | var w1: Limb = @as(Half, @truncate(t)); | 1160 | var w1: Limb = @as(Half, @truncate(t)); |
| 1161 | const w2 = @as(Half, @truncate(t >> half_bits)); | 1161 | const w2: Half = @truncate(t >> half_bits); |
| 1162 | w1 += math.mulWide(Half, x0, y1); | 1162 | w1 += math.mulWide(Half, x0, y1); |
| 1163 | const hi = math.mulWide(Half, x1, y1) + w2 + (w1 >> half_bits); | 1163 | const hi = math.mulWide(Half, x1, y1) + w2 + (w1 >> half_bits); |
| 1164 | const lo = x *% y; | 1164 | const lo = x *% y; |
| ... | @@ -1202,8 +1202,8 @@ const ct_unprotected = struct { | ... | @@ -1202,8 +1202,8 @@ const ct_unprotected = struct { |
| 1202 | fn mulWide(x: Limb, y: Limb) WideLimb { | 1202 | fn mulWide(x: Limb, y: Limb) WideLimb { |
| 1203 | const wide = math.mulWide(Limb, x, y); | 1203 | const wide = math.mulWide(Limb, x, y); |
| 1204 | return .{ | 1204 | return .{ |
| 1205 | .hi = @as(Limb, @truncate(wide >> @typeInfo(Limb).int.bits)), | 1205 | .hi = @truncate(wide >> @typeInfo(Limb).int.bits), |
| 1206 | .lo = @as(Limb, @truncate(wide)), | 1206 | .lo = @truncate(wide), |
| 1207 | }; | 1207 | }; |
| 1208 | } | 1208 | } |
| 1209 | }; | 1209 | }; |