Skip to content

Commit

Permalink
Merge pull request #392 from rust-lang/minor-fixes
Browse files Browse the repository at this point in the history
Revert #385 and add some minor fixes
  • Loading branch information
calebzulawski authored Feb 17, 2024
2 parents 6ad779c + d8439e9 commit 061d5ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion crates/core_simd/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![no_std]
#![feature(
core_intrinsics,
const_intrinsic_copy,
const_refs_to_cell,
const_maybe_uninit_as_mut_ptr,
Expand Down
11 changes: 4 additions & 7 deletions crates/core_simd/src/masks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod sealed {

fn eq(self, other: Self) -> bool;

fn as_usize(self) -> usize;
fn to_usize(self) -> usize;

type Unsigned: SimdElement;

Expand Down Expand Up @@ -65,7 +65,7 @@ macro_rules! impl_element {
fn eq(self, other: Self) -> bool { self == other }

#[inline]
fn as_usize(self) -> usize {
fn to_usize(self) -> usize {
self as usize
}

Expand Down Expand Up @@ -174,10 +174,7 @@ where
#[must_use = "method returns a new mask and does not mutate the original value"]
pub unsafe fn from_int_unchecked(value: Simd<T, N>) -> Self {
// Safety: the caller must confirm this invariant
unsafe {
core::intrinsics::assume(<T as Sealed>::valid(value));
Self(mask_impl::Mask::from_int_unchecked(value))
}
unsafe { Self(mask_impl::Mask::from_int_unchecked(value)) }
}

/// Converts a vector of integers to a mask, where 0 represents `false` and -1
Expand Down Expand Up @@ -394,7 +391,7 @@ where
if min_index.eq(T::TRUE) {
None
} else {
Some(min_index.as_usize())
Some(min_index.to_usize())
}
}
}
Expand Down

0 comments on commit 061d5ac

Please sign in to comment.