Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove cfg-if dependency #101

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ff_derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ num-integer = "0.1"
proc-macro2 = "1"
quote = "1"
syn = { version = "1", features = ["full"] }
cfg-if = "1"

[badges]
maintenance = { status = "passively-maintained" }
38 changes: 18 additions & 20 deletions ff_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,30 +916,28 @@ fn prime_field_impl(
let from_repr_impl = endianness.from_repr(name, limbs);
let to_repr_impl = endianness.to_repr(quote! {#repr}, &mont_reduce_self_params, limbs);

cfg_if::cfg_if! {
if #[cfg(feature = "bits")] {
let to_le_bits_impl = ReprEndianness::Little.to_repr(
quote! {::ff::derive::bitvec::array::BitArray::new},
&mont_reduce_self_params,
limbs,
);
let prime_field_bits_impl = if cfg!(feature = "bits") {
let to_le_bits_impl = ReprEndianness::Little.to_repr(
quote! {::ff::derive::bitvec::array::BitArray::new},
&mont_reduce_self_params,
limbs,
);

let prime_field_bits_impl = quote! {
impl ::ff::PrimeFieldBits for #name {
type ReprBits = REPR_BITS;
Some(quote! {
impl ::ff::PrimeFieldBits for #name {
type ReprBits = REPR_BITS;

fn to_le_bits(&self) -> ::ff::FieldBits<REPR_BITS> {
#to_le_bits_impl
}
fn to_le_bits(&self) -> ::ff::FieldBits<REPR_BITS> {
#to_le_bits_impl
}

fn char_le_bits() -> ::ff::FieldBits<REPR_BITS> {
::ff::FieldBits::new(MODULUS)
}
fn char_le_bits() -> ::ff::FieldBits<REPR_BITS> {
::ff::FieldBits::new(MODULUS)
}
};
} else {
let prime_field_bits_impl = quote! {};
}
}
})
} else {
None
};

let top_limb_index = limbs - 1;
Expand Down