@@ -48,8 +48,8 @@ macro_rules! impl_full_ops {
4848 impl FullOps for $ty {
4949 #[ cfg( stage0) ]
5050 fn full_add( self , other: $ty, carry: bool ) -> ( bool , $ty) {
51- // this cannot overflow, the output is between 0 and 2* 2^nbits - 1
52- // FIXME will LLVM optimize this into ADC or similar?? ?
51+ // This cannot overflow; the output is between `0` and `2 * 2^nbits - 1`.
52+ // FIXME: will LLVM optimize this into ADC or similar?
5353 let ( v, carry1) = unsafe { intrinsics:: add_with_overflow( self , other) } ;
5454 let ( v, carry2) = unsafe {
5555 intrinsics:: add_with_overflow( v, if carry { 1 } else { 0 } )
@@ -58,22 +58,25 @@ macro_rules! impl_full_ops {
5858 }
5959 #[ cfg( not( stage0) ) ]
6060 fn full_add( self , other: $ty, carry: bool ) -> ( bool , $ty) {
61- // this cannot overflow, the output is between 0 and 2* 2^nbits - 1
62- // FIXME will LLVM optimize this into ADC or similar?? ?
61+ // This cannot overflow; the output is between `0` and `2 * 2^nbits - 1`.
62+ // FIXME: will LLVM optimize this into ADC or similar?
6363 let ( v, carry1) = intrinsics:: add_with_overflow( self , other) ;
6464 let ( v, carry2) = intrinsics:: add_with_overflow( v, if carry { 1 } else { 0 } ) ;
6565 ( carry1 || carry2, v)
6666 }
6767
6868 fn full_mul( self , other: $ty, carry: $ty) -> ( $ty, $ty) {
69- // this cannot overflow, the output is between 0 and 2^nbits * (2^nbits - 1)
69+ // This cannot overflow;
70+ // the output is between `0` and `2^nbits * (2^nbits - 1)`.
71+ // FIXME: will LLVM optimize this into ADC or similar?
7072 let nbits = mem:: size_of:: <$ty>( ) * 8 ;
7173 let v = ( self as $bigty) * ( other as $bigty) + ( carry as $bigty) ;
7274 ( ( v >> nbits) as $ty, v as $ty)
7375 }
7476
7577 fn full_mul_add( self , other: $ty, other2: $ty, carry: $ty) -> ( $ty, $ty) {
76- // this cannot overflow, the output is between 0 and 2^(2*nbits) - 1
78+ // This cannot overflow;
79+ // the output is between `0` and `2^nbits * (2^nbits - 1)`.
7780 let nbits = mem:: size_of:: <$ty>( ) * 8 ;
7881 let v = ( self as $bigty) * ( other as $bigty) + ( other2 as $bigty) +
7982 ( carry as $bigty) ;
@@ -82,7 +85,7 @@ macro_rules! impl_full_ops {
8285
8386 fn full_div_rem( self , other: $ty, borrow: $ty) -> ( $ty, $ty) {
8487 debug_assert!( borrow < other) ;
85- // this cannot overflow, the dividend is between 0 and other * 2^nbits - 1
88+ // This cannot overflow; the output is between `0` and ` other * ( 2^nbits - 1)`.
8689 let nbits = mem:: size_of:: <$ty>( ) * 8 ;
8790 let lhs = ( ( borrow as $bigty) << nbits) | ( self as $bigty) ;
8891 let rhs = other as $bigty;
@@ -97,7 +100,8 @@ impl_full_ops! {
97100 u8 : add( intrinsics:: u8_add_with_overflow) , mul/div( u16 ) ;
98101 u16 : add( intrinsics:: u16_add_with_overflow) , mul/div( u32 ) ;
99102 u32 : add( intrinsics:: u32_add_with_overflow) , mul/div( u64 ) ;
100- // u64: add(intrinsics::u64_add_with_overflow), mul/div(u128); // see RFC #521 for enabling this.
103+ // See RFC #521 for enabling this.
104+ // u64: add(intrinsics::u64_add_with_overflow), mul/div(u128);
101105}
102106
103107/// Table of powers of 5 representable in digits. Specifically, the largest {u8, u16, u32} value
0 commit comments