| ... | ... | @@ -207,8 +207,8 @@ pub fn Uint(comptime max_bits: comptime_int) type { |
| 207 | 207 | pub fn compare(x: Self, y: Self) math.Order { |
| 208 | 208 | return crypto.timing_safe.compare( |
| 209 | 209 | Limb, |
| 210 | | x.limbsConst(), |
| 211 | | y.limbsConst(), |
| 210 | &x.limbs_buffer, |
| 211 | &y.limbs_buffer, |
| 212 | 212 | .little, |
| 213 | 213 | ); |
| 214 | 214 | } |
| ... | ... | @@ -223,6 +223,11 @@ pub fn Uint(comptime max_bits: comptime_int) type { |
| 223 | 223 | return @as(u1, @truncate(x.limbsConst()[0])) != 0; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | pub fn isOne(x: Self) bool { |
| 227 | const x_limbs = x.limbsConst(); |
| 228 | return ct.eql((x_limbs[0] ^ 1) | orLimbs(x_limbs[1..]), 0); |
| 229 | } |
| 230 | |
| 226 | 231 | /// Adds `y` to `x`, and returns `true` if the operation overflowed. |
| 227 | 232 | pub fn addWithOverflow(x: *Self, y: Self) u1 { |
| 228 | 233 | return x.conditionalAddWithOverflow(true, y); |