Skip to content

Commit

Permalink
style: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvank committed May 27, 2020
1 parent 7d11745 commit 5b43b27
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fn define_field(name: &str, limbs: Vec<u64>) -> String {
)
}

/// Calculates `R ^ 2 mod P` and returns the result as a vector of 64bit limbs
fn calculate_r2<F: PrimeField>() -> Vec<u64> {
// R ^ 2 mod P
let r2 = BigUint::new(limbs_of::<_, u32>(F::one()))
Expand All @@ -49,6 +50,7 @@ fn calculate_r2<F: PrimeField>() -> Vec<u64> {
.collect()
}

/// Generates OpenCL constants and type definitions of prime-field `F`
fn params<F>() -> String
where
F: PrimeField,
Expand All @@ -73,6 +75,7 @@ where
)
}

/// Generates PTX-Assembly implementation of FIELD_add_/FIELD_sub_
fn field_add_sub<F>() -> String
where
F: PrimeField,
Expand Down Expand Up @@ -118,6 +121,8 @@ where
result
}

/// Returns OpenCL source-code of a ff::PrimeField with name `name`
/// Find details in README.md
pub fn field<F>(name: &str) -> String
where
F: PrimeField,
Expand Down

0 comments on commit 5b43b27

Please sign in to comment.