Skip to content

Commit

Permalink
use static_assert_imm8 instead of the generic static_assert macro
Browse files Browse the repository at this point in the history
  • Loading branch information
lqd committed Feb 28, 2021
1 parent 1c98d21 commit 0bd1315
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/core_arch/src/x86/sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ pub const fn _MM_SHUFFLE(z: u32, y: u32, x: u32, w: u32) -> i32 {
#[rustc_legacy_const_generics(2)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_shuffle_ps<const mask: i32>(a: __m128, b: __m128) -> __m128 {
static_assert!(mask: i32 where mask >= 0 && mask <= 255);
static_assert_imm8!(mask);
simd_shuffle4(
a,
b,
Expand Down
6 changes: 3 additions & 3 deletions crates/core_arch/src/x86/sse2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ pub unsafe fn _mm_movemask_epi8(a: __m128i) -> i32 {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_shuffle_epi32<const imm8: i32>(a: __m128i) -> __m128i {
static_assert!(imm8: i32 where imm8 >= 0 && imm8 <= 255);
static_assert_imm8!(imm8);
let a = a.as_i32x4();
let x: i32x4 = simd_shuffle4(
a,
Expand Down Expand Up @@ -1482,7 +1482,7 @@ pub unsafe fn _mm_shuffle_epi32<const imm8: i32>(a: __m128i) -> __m128i {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_shufflehi_epi16<const imm8: i32>(a: __m128i) -> __m128i {
static_assert!(imm8: i32 where imm8 >= 0 && imm8 <= 255);
static_assert_imm8!(imm8);
let a = a.as_i16x8();
let x: i16x8 = simd_shuffle8(
a,
Expand Down Expand Up @@ -1514,7 +1514,7 @@ pub unsafe fn _mm_shufflehi_epi16<const imm8: i32>(a: __m128i) -> __m128i {
#[rustc_legacy_const_generics(1)]
#[stable(feature = "simd_x86", since = "1.27.0")]
pub unsafe fn _mm_shufflelo_epi16<const imm8: i32>(a: __m128i) -> __m128i {
static_assert!(imm8: i32 where imm8 >= 0 && imm8 <= 255);
static_assert_imm8!(imm8);
let a = a.as_i16x8();
let x: i16x8 = simd_shuffle8(
a,
Expand Down

0 comments on commit 0bd1315

Please sign in to comment.