You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.1 KiB

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