File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
library/compiler-builtins/src/int Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -222,6 +222,10 @@ impl HInt for u128 {
222222 fn widen_mul ( self , rhs : Self ) -> Self :: D {
223223 self . zero_widen_mul ( rhs)
224224 }
225+
226+ fn widen_hi ( self ) -> Self :: D {
227+ self . widen ( ) << <Self as MinInt >:: BITS
228+ }
225229}
226230
227231impl HInt for i128 {
@@ -247,6 +251,10 @@ impl HInt for i128 {
247251 fn widen_mul ( self , rhs : Self ) -> Self :: D {
248252 unimplemented ! ( "signed i128 widening multiply is not used" )
249253 }
254+
255+ fn widen_hi ( self ) -> Self :: D {
256+ self . widen ( ) << <Self as MinInt >:: BITS
257+ }
250258}
251259
252260impl DInt for u256 {
Original file line number Diff line number Diff line change @@ -319,9 +319,7 @@ pub(crate) trait HInt: Int {
319319 /// around problems with associated type bounds (such as `Int<Othersign: DInt>`) being unstable
320320 fn zero_widen( self ) -> Self :: D ;
321321 /// Widens the integer to have double bit width and shifts the integer into the higher bits
322- fn widen_hi( self ) -> Self :: D {
323- self . widen( ) << <Self as MinInt >:: BITS
324- }
322+ fn widen_hi( self ) -> Self :: D ;
325323 /// Widening multiplication with zero widening. This cannot overflow.
326324 fn zero_widen_mul( self , rhs: Self ) -> Self :: D ;
327325 /// Widening multiplication. This cannot overflow.
@@ -364,6 +362,9 @@ macro_rules! impl_h_int {
364362 fn widen_mul( self , rhs: Self ) -> Self :: D {
365363 self . widen( ) . wrapping_mul( rhs. widen( ) )
366364 }
365+ fn widen_hi( self ) -> Self :: D {
366+ ( self as $X) << <Self as MinInt >:: BITS
367+ }
367368 }
368369 ) *
369370 } ;
You can’t perform that action at this time.
0 commit comments