Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

[do not merge] Introduce optimized from_u64 function for conversion to Montgomery form #2

Draft
wants to merge 4 commits into
base: 0.4.2
Choose a base branch
from

Conversation

moodlezoup
Copy link
Collaborator

Do not merge, for visibility only

@@ -64,6 +64,10 @@ pub trait FpConfig<const N: usize>: Send + Sync + 'static + Sized {
/// which works for every modulus.
const SQRT_PRECOMP: Option<SqrtPrecomputation<Fp<Self, N>>>;

/// Precomputed lookup table for values 0..2^16 in Montgomery form.
/// Otherwise, conversion to Montgomery form requires a multiplication by R^2.
const SMALL_ELEMENT_MONTGOMERY_PRECOMP: [Fp<Self, N>; PRECOMP_TABLE_SIZE];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered doing this with lazy_static!() or include_bytes!() + build.rs?

hi[i] = adc!(hi[i], carry, &mut carry2);
}

(self.0).0 = hi;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: formatting

@sragss
Copy link

sragss commented Feb 28, 2024

I'd suggest feature flagging this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants