add support for no_std
This commit is contained in:
parent
fda2ead377
commit
2136214934
7 changed files with 23 additions and 3 deletions
|
|
@ -32,3 +32,4 @@ cupid = "0.3"
|
|||
|
||||
[features]
|
||||
strict = []
|
||||
std = []
|
||||
|
|
@ -19,3 +19,6 @@ echo "RUSTFLAGS=${RUSTFLAGS}"
|
|||
|
||||
cargo test --target $TARGET --features "strict"
|
||||
cargo test --release --target $TARGET --features "strict"
|
||||
|
||||
cargo test --target $TARGET --features "strict,std"
|
||||
cargo test --release --target $TARGET --features "strict,std"
|
||||
|
|
|
|||
|
|
@ -128,6 +128,10 @@
|
|||
cast_possible_truncation, cast_precision_loss,
|
||||
shadow_reuse, cyclomatic_complexity, similar_names,
|
||||
doc_markdown, many_single_char_names))]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
extern crate core as std;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate stdsimd_test;
|
||||
|
|
|
|||
|
|
@ -41,3 +41,14 @@ mod abm;
|
|||
mod bmi;
|
||||
mod bmi2;
|
||||
mod tbm;
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[repr(u8)]
|
||||
pub enum c_void {
|
||||
#[doc(hidden)] __variant1,
|
||||
#[doc(hidden)] __variant2,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::os::raw::c_void;
|
||||
|
|
|
|||
|
|
@ -283,6 +283,7 @@ pub fn __unstable_detect_feature(x: __Feature) -> bool {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[cfg(feature = "std")]
|
||||
#[test]
|
||||
fn runtime_detection_x86_nocapture() {
|
||||
println!("sse: {:?}", cfg_feature_enabled!("sse"));
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use simd_llvm::simd_shuffle4;
|
||||
use v128::*;
|
||||
use v64::f32x2;
|
||||
use std::os::raw::c_void;
|
||||
use super::c_void;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
use stdsimd_test::assert_instr;
|
||||
|
||||
use std::mem;
|
||||
use std::os::raw::c_void;
|
||||
use super::c_void;
|
||||
use std::ptr;
|
||||
|
||||
use simd_llvm::{simd_cast, simd_shuffle16, simd_shuffle2, simd_shuffle4,
|
||||
|
|
@ -2242,7 +2242,7 @@ extern "C" {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::os::raw::c_void;
|
||||
use super::c_void;
|
||||
use stdsimd_test::simd_test;
|
||||
use test::black_box; // Used to inhibit constant-folding.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue