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);
33
34struct Circom_Component {
35 Circom_HashTable hashTable;
36 Circom_ComponentEntries entries;
37 Circom_ComponentFunction fn;
38 int inputSignals;
39};
40
41class Circom_Circuit {
42public:
43 int NSignals;
44 int NComponents;
45 int NInputs;
46 int NOutputs;
47 int NVars;
48 int *wit2sig;
49 Circom_Component *components;
50 u32 *mapIsInput;
51 const char *P;
52};
53
54#define BITMAP_ISSET(m, b) (m[b>>5] & (1 << (b&0x1F)))
55extern struct Circom_Circuit _circuit;
56
57#endif