-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
52 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
#include <stdint.h> | ||
|
||
/* A single limb (unsigned integer with 64 bits). */ | ||
typedef uint64_t limb_t; | ||
|
||
/* A 256 bit prime field element (felt), represented as four limbs (integers). */ | ||
typedef limb_t felt_t[4]; | ||
|
||
int number(); | ||
/* Gets a felt_t representing the "value" number, in montgomery format. */ | ||
void from(felt_t result, uint64_t value); | ||
|
||
/* Gets a felt_t representing 0 */ | ||
void zero(felt_t result); | ||
|
||
/* Gets a felt_t representing 1 */ | ||
void one(felt_t result); | ||
|
||
/* Writes the result variable with the sum of a and b felts. */ | ||
void add(felt_t a, felt_t b, felt_t result); | ||
|
||
/* Writes the result variable with a - b. */ | ||
void sub(felt_t a, felt_t b, felt_t result); | ||
|
||
/* Writes the result variable with a * b. */ | ||
void mul(felt_t a, felt_t b, felt_t result); | ||
|
||
/* Writes the result variable with a / b. */ | ||
void div(felt_t a, felt_t b, felt_t result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters