Merge pull request #392 from rust-lang/minor-fixes

Revert #385 and add some minor fixes
This commit is contained in:
Caleb Zulawski 2024-02-17 11:15:31 -05:00 committed by GitHub
commit 061d5acd93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 8 deletions

View File

@ -1,6 +1,5 @@
#![no_std]
#![feature(
core_intrinsics,
const_intrinsic_copy,
const_refs_to_cell,
const_maybe_uninit_as_mut_ptr,

View File

@ -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;
@ -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
}
@ -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
@ -394,7 +391,7 @@ where
if min_index.eq(T::TRUE) {
None
} else {
Some(min_index.as_usize())
Some(min_index.to_usize())
}
}
}