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#include "fr.h"
7
8class Circom_CalcWit;
9typedef unsigned long long u64;
10typedef uint32_t u32;
11typedef uint8_t u8;
12
13typedef int Circom_Size;
14typedef Circom_Size *Circom_Sizes;
15
16struct Circom_HashEntry {
17 u64 hash;
18 int pos;
19};
20typedef Circom_HashEntry *Circom_HashTable;
21
22typedef enum { _typeSignal, _typeComponent} Circom_EntryType;
23
24struct Circom_ComponentEntry {
25 int offset;
26 Circom_Sizes sizes;
27 Circom_EntryType type;
28};
29typedef Circom_ComponentEntry *Circom_ComponentEntries;
30
31typedef void (*Circom_ComponentFunction)(Circom_CalcWit *ctx, int __cIdx);
32
33struct Circom_Component {
34 Circom_HashTable hashTable;
35 Circom_ComponentEntries entries;
36 Circom_ComponentFunction fn;
37 int inputSignals;
38 bool newThread;
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 PFrElement constants;
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