mirror of
https://github.com/Lokathor/bytemuck.git
synced 2024-11-25 00:02:22 +00:00
nightly_portable_simd
This commit is contained in:
parent
a64046f3b8
commit
dd01ccae42
@ -23,6 +23,9 @@ wasm_simd = [] # Until >= 1.54.0 is MSRV this is an off-by-default feature.
|
||||
# Do not use if you can avoid it, because this is unsound.
|
||||
unsound_ptr_pod_impl = []
|
||||
|
||||
# NOT SEMVER SUPPORTED! TEMPORARY ONLY!
|
||||
nightly_portable_simd = []
|
||||
|
||||
[dependencies]
|
||||
# use the upper line for testing against bytemuck_derive changes, if any
|
||||
#bytemuck_derive = { version = "1.0.1-alpha.0", path = "derive", optional = true }
|
||||
|
10
src/lib.rs
10
src/lib.rs
@ -1,5 +1,6 @@
|
||||
#![no_std]
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(feature = "nightly_portable_simd", feature(portable_simd))]
|
||||
|
||||
//! This crate gives small utilities for casting between plain data types.
|
||||
//!
|
||||
@ -59,7 +60,8 @@ macro_rules! impl_unsafe_marker_for_array {
|
||||
}
|
||||
}
|
||||
|
||||
/// A macro to transmute between two types without requiring knowing size statically.
|
||||
/// A macro to transmute between two types without requiring knowing size
|
||||
/// statically.
|
||||
macro_rules! transmute {
|
||||
($val:expr) => {
|
||||
transmute_copy(&ManuallyDrop::new($val))
|
||||
@ -117,9 +119,9 @@ fn something_went_wrong(_src: &str, _err: PodCastError) -> ! {
|
||||
panic!("{src}>{err:?}", src = _src, err = _err);
|
||||
// Note: On the spirv targets from [rust-gpu](https://github.com/EmbarkStudios/rust-gpu)
|
||||
// panic formatting cannot be used. We we just give a generic error message
|
||||
// The chance that the panicking version of these functions will ever get called
|
||||
// on spir-v targets with invalid inputs is small, but giving a simple error
|
||||
// message is better than no error message at all.
|
||||
// The chance that the panicking version of these functions will ever get
|
||||
// called on spir-v targets with invalid inputs is small, but giving a
|
||||
// simple error message is better than no error message at all.
|
||||
#[cfg(target_arch = "spirv")]
|
||||
panic!("Called a panicing helper from bytemuck which paniced");
|
||||
}
|
||||
|
@ -108,3 +108,11 @@ unsafe impl Pod for x86_64::__m256i {}
|
||||
unsafe impl Pod for x86_64::__m256 {}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
unsafe impl Pod for x86_64::__m256d {}
|
||||
|
||||
#[cfg(feature = "nightly_portable_simd")]
|
||||
unsafe impl<T, const N: usize> Pod for core::simd::Simd<T, N>
|
||||
where
|
||||
T: core::simd::SimdElement + Pod,
|
||||
core::simd::LaneCount<N>: core::simd::SupportedLaneCount,
|
||||
{
|
||||
}
|
||||
|
@ -147,3 +147,11 @@ unsafe impl Zeroable for x86_64::__m256i {}
|
||||
unsafe impl Zeroable for x86_64::__m256 {}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
unsafe impl Zeroable for x86_64::__m256d {}
|
||||
|
||||
#[cfg(feature = "nightly_portable_simd")]
|
||||
unsafe impl<T, const N: usize> Zeroable for core::simd::Simd<T, N>
|
||||
where
|
||||
T: core::simd::SimdElement + Zeroable,
|
||||
core::simd::LaneCount<N>: core::simd::SupportedLaneCount,
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user