Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
feat: implement FieldElement::from<bool>() (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Apr 18, 2023
1 parent 7352802 commit 476cfa2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions acir_field/src/generic_ark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ impl<F: PrimeField> From<u128> for FieldElement<F> {
}
}

impl<F: PrimeField> From<bool> for FieldElement<F> {
fn from(boolean: bool) -> FieldElement<F> {
if boolean {
FieldElement::one()
} else {
FieldElement::zero()
}
}
}

impl<F: PrimeField> FieldElement<F> {
pub fn one() -> FieldElement<F> {
FieldElement(F::one())
Expand Down

0 comments on commit 476cfa2

Please sign in to comment.