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 {
1616 /// Panics if `rhs` has a larger precision than `self`.
1717 #[ inline]
1818 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 ) ) ;
2020
2121 for i in 0 ..self . nlimbs ( ) {
2222 let ( limb, b) = self . limbs [ i] . adc ( * rhs. as_ref ( ) . get ( i) . unwrap_or ( & Limb :: ZERO ) , carry) ;
@@ -264,4 +264,11 @@ mod tests {
264264 let result = BoxedUint :: max ( Limb :: BITS ) . checked_add ( & BoxedUint :: one ( ) ) ;
265265 assert ! ( !bool :: from( result. is_some( ) ) ) ;
266266 }
267+
268+ #[ test]
269+ fn add_assign ( ) {
270+ let mut h = BoxedUint :: one ( ) . widen ( 1024 ) ;
271+
272+ h += BoxedUint :: one ( ) ;
273+ }
267274}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ impl BoxedUint {
1616 /// Panics if `rhs` has a larger precision than `self`.
1717 #[ inline( always) ]
1818 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 ) ) ;
2020
2121 for i in 0 ..self . nlimbs ( ) {
2222 let ( limb, b) = self . limbs [ i] . sbb ( * rhs. as_ref ( ) . get ( i) . unwrap_or ( & Limb :: ZERO ) , borrow) ;
@@ -268,4 +268,10 @@ mod tests {
268268 let result = BoxedUint :: zero ( ) . checked_sub ( & BoxedUint :: one ( ) ) ;
269269 assert ! ( !bool :: from( result. is_some( ) ) ) ;
270270 }
271+
272+ #[ test]
273+ fn sub_assign ( ) {
274+ let mut h = BoxedUint :: one ( ) . widen ( 1024 ) ;
275+ h -= BoxedUint :: one ( ) ;
276+ }
271277}
You can’t perform that action at this time.
0 commit comments