Skip to content

Commit

Permalink
feat(math): introduce field conversion methods in CurveConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
fakedev9999 committed Oct 25, 2023
1 parent 3d9e83a commit bbdeb05
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ int GenerationConfig::GenerateConfigHdr() const {
" constexpr static BaseField MulByA(const BaseField& v) {",
"%{mul_by_a}",
" }",
"",
" constexpr static ScalarField BaseToScalar(const BaseField& v) {",
" return ScalarField::FromBigInt(v.ToBigInt() % ScalarField::Config::kModulus);",
" }",
"",
" constexpr static BaseField ScalarToBase(const ScalarField& v) {",
" return BaseField::FromBigInt(v.ToBigInt() % BaseField::Config::kModulus);",
" }",
"};",
"",
"template <typename BaseField, typename ScalarField>",
Expand Down

0 comments on commit bbdeb05

Please sign in to comment.