arnaucube
arnaucube/circomPublic Self-hosted repository
circom/ports/c/zqfield.h
ports/c/zqfield.hRaw
 1#ifndef ZQFIELD_H
 2#define ZQFIELD_H
 3
 4#include "circom.h"
 5
 6class ZqField {
 7public:
 8    BigInt p;
 9    BigInt one;
10    BigInt zero;
11    size_t nBits;
12    BigInt mask;
13    ZqField(PBigInt ap);
14    ~ZqField();
15
16    void copyn(PBigInt a, PBigInt b, int n);
17
18    void add(PBigInt r,PBigInt a, PBigInt b);
19    void sub(PBigInt r,PBigInt a, PBigInt b);
20    void neg(PBigInt r,PBigInt a);
21    void mul(PBigInt r,PBigInt a, PBigInt b);
22    void div(PBigInt r,PBigInt a, PBigInt b);
23    void idiv(PBigInt r,PBigInt a, PBigInt b);
24    void mod(PBigInt r,PBigInt a, PBigInt b);
25    void pow(PBigInt r,PBigInt a, PBigInt b);
26
27    void lt(PBigInt r, PBigInt a, PBigInt b);
28    void eq(PBigInt r, PBigInt a, PBigInt b);
29    void gt(PBigInt r, PBigInt a, PBigInt b);
30    void leq(PBigInt r, PBigInt a, PBigInt b);
31    void geq(PBigInt r, PBigInt a, PBigInt b);
32    void neq(PBigInt r, PBigInt a, PBigInt b);
33
34    void land(PBigInt r, PBigInt a, PBigInt b);
35    void lor(PBigInt r, PBigInt a, PBigInt b);
36    void lnot(PBigInt r, PBigInt a);
37
38    void band(PBigInt r, PBigInt a, PBigInt b);
39    void bor(PBigInt r, PBigInt a, PBigInt b);
40    void bxor(PBigInt r, PBigInt a, PBigInt b);
41    void bnot(PBigInt r, PBigInt a);
42    void shl(PBigInt r, PBigInt a, PBigInt b);
43    void shr(PBigInt r, PBigInt a, PBigInt b);
44
45    int isTrue(PBigInt a);
46    int toInt(PBigInt a);
47};
48
49#endif // ZQFIELD_H