diff options
| author | Ryo Onodera <[email protected]> | 2024-03-08 00:01:48 +0900 |
|---|---|---|
| committer | Jack O'Connor <[email protected]> | 2024-03-09 16:56:59 -0800 |
| commit | e6e7f27336a9f21cb6d0f64ebf0d755bf0db0d3a (patch) | |
| tree | 23e6e64659ddfc02088d48b573496778507f3817 | |
| parent | 8fc36186b84385d36d8339606e4d1ea6ff471965 (diff) | |
Support running inside miri
| -rw-r--r-- | src/platform.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/platform.rs b/src/platform.rs index ef910aa..79bc9a3 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -56,6 +56,11 @@ pub enum Platform { impl Platform { #[allow(unreachable_code)] pub fn detect() -> Self { + #[cfg(miri)] + { + return Platform::Portable; + } + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { #[cfg(blake3_avx512_ffi)] @@ -329,6 +334,10 @@ impl Platform { #[inline(always)] #[allow(unreachable_code)] pub fn avx512_detected() -> bool { + if cfg!(miri) { + return false; + } + // A testing-only short-circuit. if cfg!(feature = "no_avx512") { return false; @@ -352,6 +361,10 @@ pub fn avx512_detected() -> bool { #[inline(always)] #[allow(unreachable_code)] pub fn avx2_detected() -> bool { + if cfg!(miri) { + return false; + } + // A testing-only short-circuit. if cfg!(feature = "no_avx2") { return false; @@ -375,6 +388,10 @@ pub fn avx2_detected() -> bool { #[inline(always)] #[allow(unreachable_code)] pub fn sse41_detected() -> bool { + if cfg!(miri) { + return false; + } + // A testing-only short-circuit. if cfg!(feature = "no_sse41") { return false; @@ -398,6 +415,10 @@ pub fn sse41_detected() -> bool { #[inline(always)] #[allow(unreachable_code)] pub fn sse2_detected() -> bool { + if cfg!(miri) { + return false; + } + // A testing-only short-circuit. if cfg!(feature = "no_sse2") { return false; |
