Skip to content

Commit

Permalink
Change to bits cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
pinkforest committed Dec 7, 2022
1 parent 5267551 commit 731d2d2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 28 deletions.
8 changes: 0 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,3 @@ alloc = ["zeroize/alloc"]
fiat_backend = ["fiat-crypto"]
# The SIMD backend uses parallel formulas, using either AVX2 or AVX512-IFMA.
simd_backend = ["nightly", "packed_simd"]

# Target backend overrides for fiat_backend
fiat_64 = []
fiat_32 = []

# Target backend overrides for the default serial backend
serial_64 = []
serial_32 = []
25 changes: 5 additions & 20 deletions src/backend/serial/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,20 @@ use cfg_if::cfg_if;

cfg_if! {

if #[cfg(any(feature = "fiat_backend", feature = "fiat_64", feature = "fiat_32"))] {
if #[cfg(any(feature = "fiat_backend"))] {

#[cfg(all(feature = "fiat_64", feature = "fiat_32"))]
compile_error!("Overrides fiat_64 or fiat_32 are mutually exclusive - cannot enable both.");

#[cfg(any(
all(not(target_pointer_width = "64"), not(feature = "fiat_64")),
feature = "fiat_32"
))]
#[cfg(dalek_bits = "32")]
pub mod fiat_u32;

#[cfg(any(
all(target_pointer_width = "64", not(feature = "fiat_32")),
feature = "fiat_64"
))]
#[cfg(dalek_bits = "64")]
pub mod fiat_u64;

} else {

#[cfg(all(feature = "serial_64", feature = "serial_32"))]
compile_error!("Overrides serial_64 or serial_32 are mutually exclusive - cannot enable both.");

#[cfg(any(
all(not(target_pointer_width = "64"), not(feature = "serial_64")),
feature = "serial_32"
))]
#[cfg(dalek_bits = "32")]
pub mod u32;

#[cfg(any(all(target_pointer_width = "64", not(feature = "serial_32")), feature = "serial_64"))]
#[cfg(dalek_bits = "64")]
pub mod u64;

}
Expand Down
17 changes: 17 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@
)]
#![doc(html_root_url = "https://docs.rs/curve25519-dalek/4.0.0-pre.2")]
#![doc = include_str!("../README.md")]
//------------------------------------------------------------------------
// curve25519-dalek arithmetric overrides
//------------------------------------------------------------------------
#![cfg_attr(
any(
all(not(target_pointer_width = "64"), not(dalek_bits = "64")),
dalek_bits = "32"
),
cfg(dalek_bits = "32")
)]
#![cfg_attr(
any(
all(target_pointer_width = "64", not(dalek_bits = "32")),
dalek_bits = "64"
),
cfg(dalek_bits = "64")
)]

//------------------------------------------------------------------------
// External dependencies:
Expand Down

0 comments on commit 731d2d2

Please sign in to comment.