mirror of
https://github.com/BLAKE3-team/BLAKE3
synced 2024-05-17 11:26:22 +02:00
Support running inside miri
This commit is contained in:
parent
8fc36186b8
commit
e6e7f27336
|
@ -56,6 +56,11 @@ pub enum Platform {
|
||||||
impl Platform {
|
impl Platform {
|
||||||
#[allow(unreachable_code)]
|
#[allow(unreachable_code)]
|
||||||
pub fn detect() -> Self {
|
pub fn detect() -> Self {
|
||||||
|
#[cfg(miri)]
|
||||||
|
{
|
||||||
|
return Platform::Portable;
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||||
{
|
{
|
||||||
#[cfg(blake3_avx512_ffi)]
|
#[cfg(blake3_avx512_ffi)]
|
||||||
|
@ -329,6 +334,10 @@ impl Platform {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[allow(unreachable_code)]
|
#[allow(unreachable_code)]
|
||||||
pub fn avx512_detected() -> bool {
|
pub fn avx512_detected() -> bool {
|
||||||
|
if cfg!(miri) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// A testing-only short-circuit.
|
// A testing-only short-circuit.
|
||||||
if cfg!(feature = "no_avx512") {
|
if cfg!(feature = "no_avx512") {
|
||||||
return false;
|
return false;
|
||||||
|
@ -352,6 +361,10 @@ pub fn avx512_detected() -> bool {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[allow(unreachable_code)]
|
#[allow(unreachable_code)]
|
||||||
pub fn avx2_detected() -> bool {
|
pub fn avx2_detected() -> bool {
|
||||||
|
if cfg!(miri) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// A testing-only short-circuit.
|
// A testing-only short-circuit.
|
||||||
if cfg!(feature = "no_avx2") {
|
if cfg!(feature = "no_avx2") {
|
||||||
return false;
|
return false;
|
||||||
|
@ -375,6 +388,10 @@ pub fn avx2_detected() -> bool {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[allow(unreachable_code)]
|
#[allow(unreachable_code)]
|
||||||
pub fn sse41_detected() -> bool {
|
pub fn sse41_detected() -> bool {
|
||||||
|
if cfg!(miri) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// A testing-only short-circuit.
|
// A testing-only short-circuit.
|
||||||
if cfg!(feature = "no_sse41") {
|
if cfg!(feature = "no_sse41") {
|
||||||
return false;
|
return false;
|
||||||
|
@ -398,6 +415,10 @@ pub fn sse41_detected() -> bool {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[allow(unreachable_code)]
|
#[allow(unreachable_code)]
|
||||||
pub fn sse2_detected() -> bool {
|
pub fn sse2_detected() -> bool {
|
||||||
|
if cfg!(miri) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// A testing-only short-circuit.
|
// A testing-only short-circuit.
|
||||||
if cfg!(feature = "no_sse2") {
|
if cfg!(feature = "no_sse2") {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue