arnaucube
arnaucube/circomPublic Self-hosted repository
circom/c/circom.h
c/circom.hRaw
 1#ifndef __CIRCOM_H
 2#define __CIRCOM_H
 3
 4#include <gmp.h>
 5#include <stdint.h>
 6
 7class Circom_CalcWit;
 8typedef unsigned long long u64;
 9typedef uint32_t u32;
10typedef uint8_t u8;
11typedef mpz_t BigInt;
12typedef BigInt *PBigInt;
13
14typedef int Circom_Size;
15typedef Circom_Size *Circom_Sizes;
16
17struct Circom_HashEntry {
18    u64 hash;
19    int pos;
20};
21typedef Circom_HashEntry *Circom_HashTable;
22
23typedef enum  { _typeSignal, _typeComponent} Circom_EntryType;
24
25struct Circom_ComponentEntry {
26    int offset;
27    Circom_Sizes sizes;
28    Circom_EntryType type;
29};
30typedef Circom_ComponentEntry *Circom_ComponentEntries;
31
32typedef void (*Circom_ComponentFunction)(Circom_CalcWit *ctx, int __cIdx);
33
34struct Circom_Component {
35    Circom_HashTable hashTable;
36    Circom_ComponentEntries entries;
37    Circom_ComponentFunction fn;
38    int inputSignals;
39    bool newThread;
40};
41
42class Circom_Circuit {
43public:
44    int NSignals;
45    int NComponents;
46    int NInputs;
47    int NOutputs;
48    int NVars;
49    int *wit2sig;
50    Circom_Component *components;
51    u32 *mapIsInput;
52    const char *P;
53};
54
55#define BITMAP_ISSET(m, b) (m[b>>5] & (1 << (b&0x1F)))
56extern struct Circom_Circuit _circuit;
57
58#endif