Skip to content

Commit 0e98bf1

Browse files
committed
fixing
1 parent cfc3507 commit 0e98bf1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

crates/core_simd/src/ops.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,15 @@ macro_rules! impl_unsigned_int_ops {
311311
if rhs == 0 {
312312
panic!("attempt to divide by zero");
313313
}
314+
<<<<<<< HEAD
314315
if <$scalar>::MIN != 0 && rhs == -1 as _ {
315316
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+
>>>>>>> 549f751... actually check if lhs == MIN in div/rem overflow guards
316323
}
317324
let rhs = Self::splat(rhs);
318325
unsafe { crate::intrinsics::simd_div(self, rhs) }
@@ -385,8 +392,14 @@ macro_rules! impl_unsigned_int_ops {
385392
if rhs == 0 {
386393
panic!("attempt to calculate the remainder with a divisor of zero");
387394
}
395+
<<<<<<< HEAD
388396
if <$scalar>::MIN != 0 && rhs == -1 as _ {
389397
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+
>>>>>>> 549f751... actually check if lhs == MIN in div/rem overflow guards
390403
}
391404
let rhs = Self::splat(rhs);
392405
unsafe { crate::intrinsics::simd_rem(self, rhs) }

0 commit comments

Comments
 (0)