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
4 years ago
5 years ago
4 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. class Circom_CalcWit;
  6. typedef unsigned long long u64;
  7. typedef uint32_t u32;
  8. typedef uint8_t u8;
  9. typedef mpz_t BigInt;
  10. typedef BigInt *PBigInt;
  11. typedef int Circom_Size;
  12. typedef Circom_Size *Circom_Sizes;
  13. struct Circom_HashEntry {
  14. u64 hash;
  15. int pos;
  16. };
  17. typedef Circom_HashEntry *Circom_HashTable;
  18. typedef enum { _typeSignal, _typeComponent} Circom_EntryType;
  19. struct Circom_ComponentEntry {
  20. int offset;
  21. Circom_Sizes sizes;
  22. Circom_EntryType type;
  23. };
  24. typedef Circom_ComponentEntry *Circom_ComponentEntries;
  25. typedef void (*Circom_ComponentFunction)(Circom_CalcWit *ctx, int __cIdx);
  26. struct Circom_Component {
  27. Circom_HashTable hashTable;
  28. Circom_ComponentEntries entries;
  29. Circom_ComponentFunction fn;
  30. int inputSignals;
  31. bool newThread;
  32. };
  33. class Circom_Circuit {
  34. public:
  35. int NSignals;
  36. int NComponents;
  37. int NInputs;
  38. int NOutputs;
  39. int NVars;
  40. int *wit2sig;
  41. Circom_Component *components;
  42. u32 *mapIsInput;
  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