File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -311,8 +311,15 @@ macro_rules! impl_unsigned_int_ops {
311
311
if rhs == 0 {
312
312
panic!( "attempt to divide by zero" ) ;
313
313
}
314
+ <<<<<<< HEAD
314
315
if <$scalar>:: MIN != 0 && rhs == -1 as _ {
315
316
panic!( "attempt to divide with overflow" ) ;
317
+ =======
318
+ if <$scalar>:: MIN != 0 &&
319
+ self . as_slice( ) . iter( ) . any( |x| * x == <$scalar>:: MIN ) &&
320
+ rhs == -1 as _ {
321
+ panic!( "dividing MIN by -1 is undefined" ) ;
322
+ >>>>>>> 549 f751... actually check if lhs == MIN in div/rem overflow guards
316
323
}
317
324
let rhs = Self :: splat( rhs) ;
318
325
unsafe { crate :: intrinsics:: simd_div( self , rhs) }
@@ -385,8 +392,14 @@ macro_rules! impl_unsigned_int_ops {
385
392
if rhs == 0 {
386
393
panic!( "attempt to calculate the remainder with a divisor of zero" ) ;
387
394
}
395
+ <<<<<<< HEAD
388
396
if <$scalar>:: MIN != 0 && rhs == -1 as _ {
389
397
panic!( "attempt to calculate the remainder with overflow" ) ;
398
+ =======
399
+ if <$scalar>:: MIN != 0 && self . as_slice( ) . iter( ) . any( |x| * x == <$scalar>:: MIN ) && rhs == -1 as _ {
400
+ panic!( "MIN modulo -1 is undefined" ) ;
401
+
402
+ >>>>>>> 549 f751... actually check if lhs == MIN in div/rem overflow guards
390
403
}
391
404
let rhs = Self :: splat( rhs) ;
392
405
unsafe { crate :: intrinsics:: simd_rem( self , rhs) }
You can’t perform that action at this time.
0 commit comments