Skip to content

Commit

Permalink
Merge pull request rust-lang#385 from workingjubilee/make-an-ass-out-…
Browse files Browse the repository at this point in the history
…of-u-and-me

Assume masks are correct
  • Loading branch information
calebzulawski authored Feb 17, 2024
2 parents b2e1bcb + b6eeb4e commit 6ad779c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/core_simd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
const_maybe_uninit_as_mut_ptr,
const_mut_refs,
convert_float_to_int,
core_intrinsics,
decl_macro,
inline_const,
intra_doc_pointers,
Expand Down
5 changes: 4 additions & 1 deletion crates/core_simd/src/masks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ 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 { Self(mask_impl::Mask::from_int_unchecked(value)) }
unsafe {
core::intrinsics::assume(<T as Sealed>::valid(value));
Self(mask_impl::Mask::from_int_unchecked(value))
}
}

/// Converts a vector of integers to a mask, where 0 represents `false` and -1
Expand Down

0 comments on commit 6ad779c

Please sign in to comment.