File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ impl BoxedUint {
16
16
/// Panics if `rhs` has a larger precision than `self`.
17
17
#[ inline]
18
18
pub fn adc_assign ( & mut self , rhs : impl AsRef < [ Limb ] > , mut carry : Limb ) -> Limb {
19
- debug_assert ! ( self . bits_precision( ) < = ( rhs. as_ref( ) . len( ) as u32 * Limb :: BITS ) ) ;
19
+ debug_assert ! ( self . bits_precision( ) > = ( rhs. as_ref( ) . len( ) as u32 * Limb :: BITS ) ) ;
20
20
21
21
for i in 0 ..self . nlimbs ( ) {
22
22
let ( limb, b) = self . limbs [ i] . adc ( * rhs. as_ref ( ) . get ( i) . unwrap_or ( & Limb :: ZERO ) , carry) ;
@@ -264,4 +264,11 @@ mod tests {
264
264
let result = BoxedUint :: max ( Limb :: BITS ) . checked_add ( & BoxedUint :: one ( ) ) ;
265
265
assert ! ( !bool :: from( result. is_some( ) ) ) ;
266
266
}
267
+
268
+ #[ test]
269
+ fn add_assign ( ) {
270
+ let mut h = BoxedUint :: one ( ) . widen ( 1024 ) ;
271
+
272
+ h += BoxedUint :: one ( ) ;
273
+ }
267
274
}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ impl BoxedUint {
16
16
/// Panics if `rhs` has a larger precision than `self`.
17
17
#[ inline( always) ]
18
18
pub fn sbb_assign ( & mut self , rhs : impl AsRef < [ Limb ] > , mut borrow : Limb ) -> Limb {
19
- debug_assert ! ( self . bits_precision( ) < = ( rhs. as_ref( ) . len( ) as u32 * Limb :: BITS ) ) ;
19
+ debug_assert ! ( self . bits_precision( ) > = ( rhs. as_ref( ) . len( ) as u32 * Limb :: BITS ) ) ;
20
20
21
21
for i in 0 ..self . nlimbs ( ) {
22
22
let ( limb, b) = self . limbs [ i] . sbb ( * rhs. as_ref ( ) . get ( i) . unwrap_or ( & Limb :: ZERO ) , borrow) ;
@@ -268,4 +268,10 @@ mod tests {
268
268
let result = BoxedUint :: zero ( ) . checked_sub ( & BoxedUint :: one ( ) ) ;
269
269
assert ! ( !bool :: from( result. is_some( ) ) ) ;
270
270
}
271
+
272
+ #[ test]
273
+ fn sub_assign ( ) {
274
+ let mut h = BoxedUint :: one ( ) . widen ( 1024 ) ;
275
+ h -= BoxedUint :: one ( ) ;
276
+ }
271
277
}
You can’t perform that action at this time.
0 commit comments