x86_simd/
lib.rs

1#![doc = include_str!("../README.md")]
2#![deny(missing_copy_implementations, missing_debug_implementations)]
3#![deny(rustdoc::broken_intra_doc_links)]
4#![deny(clippy::cast_possible_truncation)]
5#![warn(missing_docs)]
6
7// Allow using Sealed trait bounds to limit how much people can shoot themselves in the foot with this crate.
8#![allow(private_bounds)]
9
10// Allow unreachable code as parts of this library (especially fall-back code) will become unreachable when
11// certain compiler flags are enabled.
12#![allow(unreachable_code)]
13
14#![allow(clippy::missing_transmute_annotations)]
15
16#![cfg_attr(not(feature = "std"), no_std)]
17
18// Compiler directive to get docs.rs (which uses the nightly version of the rust compiler) to show
19// info about feature required for various modules and functionality.
20//
21// See: <https://stackoverflow.com/a/70914430>.
22#![cfg_attr(all(doc, CHANNEL_NIGHTLY), feature(doc_auto_cfg))]
23
24#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
25core::compile_error!("The x86-simd crate only supports x86 and x86_64 architectures");
26
27/// A version of [core::hint::unreachable_unchecked] that's only unchecked on release builds, defaulting to
28/// [`core::unreachable`] on debug.
29///
30/// This is used throughout this crate.
31///
32/// # Safety
33/// This is unsafe for the same reasons as [core::hint::unreachable_unchecked].
34pub const unsafe fn unreachable_uncheched_on_release() -> ! {
35    #[cfg(debug_assertions)]
36    core::unreachable!();
37
38    #[cfg(not(debug_assertions))]
39    core::hint::unreachable_unchecked()
40}
41
42mod sealed;
43
44pub mod integers;