| 1 |
#![cfg(any(feature = "cipher", feature = "rng"))] |
| 2 |
|
| 3 |
use cfg_if::cfg_if; |
| 4 |
|
| 5 |
cfg_if! { |
| 6 |
if #[cfg(chacha20_backend = "soft")] { |
| 7 |
pub(crate) mod soft; |
| 8 |
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] { |
| 9 |
cfg_if! { |
| 10 |
if #[cfg(all(chacha20_avx512, chacha20_backend = "avx512"))] { |
| 11 |
pub(crate) mod avx512; |
| 12 |
// AVX-2 backend needed for RNG if enabled |
| 13 |
#[cfg(feature = "rng")] |
| 14 |
pub(crate) mod avx2; |
| 15 |
} else if #[cfg(chacha20_backend = "avx2")] { |
| 16 |
pub(crate) mod avx2; |
| 17 |
} else if #[cfg(chacha20_backend = "sse2")] { |
| 18 |
pub(crate) mod sse2; |
| 19 |
} else { |
| 20 |
pub(crate) mod soft; |
| 21 |
#[cfg(chacha20_avx512)] |
| 22 |
pub(crate) mod avx512; |
| 23 |
pub(crate) mod avx2; |
| 24 |
pub(crate) mod sse2; |
| 25 |
} |
| 26 |
} |
| 27 |
} else if #[cfg(all(target_arch = "aarch64", target_feature = "neon"))] { |
| 28 |
pub(crate) mod neon; |
| 29 |
} else { |
| 30 |
pub(crate) mod soft; |
| 31 |
} |
| 32 |
} |