Skip to content

Commit 8e6bf82

Browse files
eduardosmAmanieu
authored andcommitted
Replace some x >= LO && x <= HI with matches!(x, LO..=HI)
1 parent 2146a74 commit 8e6bf82

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/core_arch/src/x86/avx512vbmi2.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,7 +2245,7 @@ pub unsafe fn _mm_maskz_shrdi_epi32<const IMM8: i32>(
22452245
pub unsafe fn _mm512_shrdi_epi16<const IMM8: i32>(a: __m512i, b: __m512i) -> __m512i {
22462246
static_assert_uimm_bits!(IMM8, 8);
22472247
let imm8 = IMM8 as i16;
2248-
assert!(imm8 >= 0 && imm8 <= 255);
2248+
assert!(matches!(imm8, 0..=255));
22492249
transmute(vpshrdvw(
22502250
a.as_i16x32(),
22512251
b.as_i16x32(),
@@ -2269,7 +2269,7 @@ pub unsafe fn _mm512_mask_shrdi_epi16<const IMM8: i32>(
22692269
) -> __m512i {
22702270
static_assert_uimm_bits!(IMM8, 8);
22712271
let imm8 = IMM8 as i16;
2272-
assert!(imm8 >= 0 && imm8 <= 255);
2272+
assert!(matches!(imm8, 0..=255));
22732273
let shf: i16x32 = vpshrdvw(
22742274
a.as_i16x32(),
22752275
b.as_i16x32(),
@@ -2293,7 +2293,7 @@ pub unsafe fn _mm512_maskz_shrdi_epi16<const IMM8: i32>(
22932293
) -> __m512i {
22942294
static_assert_uimm_bits!(IMM8, 8);
22952295
let imm8 = IMM8 as i16;
2296-
assert!(imm8 >= 0 && imm8 <= 255);
2296+
assert!(matches!(imm8, 0..=255));
22972297
let shf: i16x32 = vpshrdvw(
22982298
a.as_i16x32(),
22992299
b.as_i16x32(),
@@ -2314,7 +2314,7 @@ pub unsafe fn _mm512_maskz_shrdi_epi16<const IMM8: i32>(
23142314
pub unsafe fn _mm256_shrdi_epi16<const IMM8: i32>(a: __m256i, b: __m256i) -> __m256i {
23152315
static_assert_uimm_bits!(IMM8, 8);
23162316
let imm8 = IMM8 as i16;
2317-
assert!(imm8 >= 0 && imm8 <= 255);
2317+
assert!(matches!(imm8, 0..=255));
23182318
transmute(vpshrdvw256(
23192319
a.as_i16x16(),
23202320
b.as_i16x16(),
@@ -2338,7 +2338,7 @@ pub unsafe fn _mm256_mask_shrdi_epi16<const IMM8: i32>(
23382338
) -> __m256i {
23392339
static_assert_uimm_bits!(IMM8, 8);
23402340
let imm8 = IMM8 as i16;
2341-
assert!(imm8 >= 0 && imm8 <= 255);
2341+
assert!(matches!(imm8, 0..=255));
23422342
let shf: i16x16 = vpshrdvw256(
23432343
a.as_i16x16(),
23442344
b.as_i16x16(),

0 commit comments

Comments
 (0)