Skip to content

Commit

Permalink
updating fr to admit hexadecimal, octal... inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
clararod9 committed May 11, 2023
1 parent 2f5dee0 commit 023bafe
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions code_producers/src/c_elements/grumpkin/fr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ bool Fr_init() {
return true;
}

void Fr_str2element(PFrElement pE, char const *s) {
void Fr_str2element(PFrElement pE, char const *s, uint base) {
mpz_t mr;
mpz_init_set_str(mr, s, 10);
mpz_init_set_str(mr, s, base);
mpz_fdiv_r(mr, mr, q);
Fr_fromMpz(pE, mr);
mpz_clear(mr);
Expand Down
2 changes: 1 addition & 1 deletion code_producers/src/c_elements/grumpkin/fr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern "C" void Fr_fail();

// Pending functions to convert

void Fr_str2element(PFrElement pE, char const*s);
void Fr_str2element(PFrElement pE, char const*s, uint base);
char *Fr_element2str(PFrElement pE);
void Fr_idiv(PFrElement r, PFrElement a, PFrElement b);
void Fr_mod(PFrElement r, PFrElement a, PFrElement b);
Expand Down
4 changes: 2 additions & 2 deletions code_producers/src/c_elements/pallas/fr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ bool Fr_init() {
return true;
}

void Fr_str2element(PFrElement pE, char const *s) {
void Fr_str2element(PFrElement pE, char const *s, uint base) {
mpz_t mr;
mpz_init_set_str(mr, s, 10);
mpz_init_set_str(mr, s, base);
mpz_fdiv_r(mr, mr, q);
Fr_fromMpz(pE, mr);
mpz_clear(mr);
Expand Down
2 changes: 1 addition & 1 deletion code_producers/src/c_elements/pallas/fr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern "C" void Fr_fail();

// Pending functions to convert

void Fr_str2element(PFrElement pE, char const*s);
void Fr_str2element(PFrElement pE, char const*s, uint base);
char *Fr_element2str(PFrElement pE);
void Fr_idiv(PFrElement r, PFrElement a, PFrElement b);
void Fr_mod(PFrElement r, PFrElement a, PFrElement b);
Expand Down
4 changes: 2 additions & 2 deletions code_producers/src/c_elements/vesta/fr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ bool Fr_init() {
return true;
}

void Fr_str2element(PFrElement pE, char const *s) {
void Fr_str2element(PFrElement pE, char const *s, uint base) {
mpz_t mr;
mpz_init_set_str(mr, s, 10);
mpz_init_set_str(mr, s, base);
mpz_fdiv_r(mr, mr, q);
Fr_fromMpz(pE, mr);
mpz_clear(mr);
Expand Down
2 changes: 1 addition & 1 deletion code_producers/src/c_elements/vesta/fr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ extern "C" void Fr_fail();

// Pending functions to convert

void Fr_str2element(PFrElement pE, char const*s);
void Fr_str2element(PFrElement pE, char const*s, uint base);
char *Fr_element2str(PFrElement pE);
void Fr_idiv(PFrElement r, PFrElement a, PFrElement b);
void Fr_mod(PFrElement r, PFrElement a, PFrElement b);
Expand Down

0 comments on commit 023bafe

Please sign in to comment.