Skip to content

Commit 9392fb1

Browse files
committed
Change mask function to accept bool
1 parent c9c0bf9 commit 9392fb1

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

crates/core_simd/src/swizzle.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,18 +499,30 @@ where
499499
/// `padding` from the right.
500500
#[inline]
501501
#[must_use = "method returns a new mask and does not mutate the original inputs"]
502-
pub fn shift_elements_left<const OFFSET: usize>(self, padding: T) -> Self {
502+
pub fn shift_elements_left<const OFFSET: usize>(self, padding: bool) -> Self {
503503
// Safety: swizzles are safe for masks
504-
unsafe { Self::from_int_unchecked(self.to_int().shift_elements_left::<OFFSET>(padding)) }
504+
unsafe {
505+
Self::from_int_unchecked(self.to_int().shift_elements_left::<OFFSET>(if padding {
506+
T::TRUE
507+
} else {
508+
T::FALSE
509+
}))
510+
}
505511
}
506512

507513
/// Shifts the mask elements to the right by `OFFSET`, filling in with
508514
/// `padding` from the left.
509515
#[inline]
510516
#[must_use = "method returns a new mask and does not mutate the original inputs"]
511-
pub fn shift_elements_right<const OFFSET: usize>(self, padding: T) -> Self {
517+
pub fn shift_elements_right<const OFFSET: usize>(self, padding: bool) -> Self {
512518
// Safety: swizzles are safe for masks
513-
unsafe { Self::from_int_unchecked(self.to_int().shift_elements_right::<OFFSET>(padding)) }
519+
unsafe {
520+
Self::from_int_unchecked(self.to_int().shift_elements_right::<OFFSET>(if padding {
521+
T::TRUE
522+
} else {
523+
T::FALSE
524+
}))
525+
}
514526
}
515527

516528
/// Interleave two masks.

0 commit comments

Comments
 (0)