Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cargo features #155

Merged
merged 4 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ jobs:
features:
- ""
- "--features std"
- "--features const_evaluatable_checked"
- "--features std --features const_evaluatable_checked"
- "--features generic_const_exprs"
- "--features std --features generic_const_exprs"

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions crates/core_simd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ categories = ["hardware-support", "no-std"]
license = "MIT OR Apache-2.0"

[features]
default = ["std", "const_evaluatable_checked"]
default = ["std", "generic_const_exprs"]
std = []
const_evaluatable_checked = []
generic_const_exprs = []

[target.'cfg(target_arch = "wasm32")'.dev-dependencies.wasm-bindgen]
version = "0.2"
Expand Down
8 changes: 4 additions & 4 deletions crates/core_simd/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#![no_std]
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(incomplete_features)]
#![feature(
const_evaluatable_checked,
adt_const_params,
const_fn_trait_bound,
const_generics,
platform_intrinsics,
repr_simd,
simd_ffi,
staged_api,
stdsimd
)]
#![cfg_attr(feature = "generic_const_exprs", feature(generic_const_exprs))]
#![warn(missing_docs)]
#![unstable(feature = "portable_simd", issue = "86656")]
//! Portable SIMD module.
Expand All @@ -22,7 +22,7 @@ mod reduction;
mod select;
pub use select::Select;

#[cfg(feature = "const_evaluatable_checked")]
#[cfg(feature = "generic_const_exprs")]
mod to_bytes;

mod comparisons;
Expand Down
2 changes: 2 additions & 0 deletions crates/core_simd/src/masks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,13 @@ where
}

/// Convert this mask to a bitmask, with one bit set per lane.
#[cfg(feature = "generic_const_exprs")]
pub fn to_bitmask(self) -> [u8; LaneCount::<LANES>::BITMASK_LEN] {
self.0.to_bitmask()
}

/// Convert a bitmask to a mask.
#[cfg(feature = "generic_const_exprs")]
pub fn from_bitmask(bitmask: [u8; LaneCount::<LANES>::BITMASK_LEN]) -> Self {
Self(mask_impl::Mask::from_bitmask(bitmask))
}
Expand Down
2 changes: 2 additions & 0 deletions crates/core_simd/src/masks/bitmask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,14 @@ where
Self(core::mem::transmute_copy(&mask), PhantomData)
}

#[cfg(feature = "generic_const_exprs")]
#[inline]
pub fn to_bitmask(self) -> [u8; LaneCount::<LANES>::BITMASK_LEN] {
// Safety: these are the same type and we are laundering the generic
unsafe { core::mem::transmute_copy(&self.0) }
}

#[cfg(feature = "generic_const_exprs")]
#[inline]
pub fn from_bitmask(bitmask: [u8; LaneCount::<LANES>::BITMASK_LEN]) -> Self {
// Safety: these are the same type and we are laundering the generic
Expand Down
2 changes: 2 additions & 0 deletions crates/core_simd/src/masks/full_masks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ where
unsafe { Mask(crate::intrinsics::simd_cast(self.0)) }
}

#[cfg(feature = "generic_const_exprs")]
#[inline]
pub fn to_bitmask(self) -> [u8; LaneCount::<LANES>::BITMASK_LEN] {
unsafe {
Expand All @@ -127,6 +128,7 @@ where
}
}

#[cfg(feature = "generic_const_exprs")]
#[inline]
pub fn from_bitmask(mut bitmask: [u8; LaneCount::<LANES>::BITMASK_LEN]) -> Self {
unsafe {
Expand Down
1 change: 1 addition & 0 deletions crates/core_simd/tests/masks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ macro_rules! test_mask_api {
assert_eq!(core_simd::Mask::<$type, 8>::from_int(int), mask);
}

#[cfg(feature = "generic_const_exprs")]
#[test]
fn roundtrip_bitmask_conversion() {
let values = [
Expand Down
4 changes: 2 additions & 2 deletions crates/core_simd/tests/to_bytes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(portable_simd, const_generics, const_evaluatable_checked)]
#![feature(portable_simd, generic_const_exprs, adt_const_params)]
#![allow(incomplete_features)]
#![cfg(feature = "const_evaluatable_checked")]
#![cfg(feature = "generic_const_exprs")]

use core_simd::Simd;

Expand Down