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.

67 lines
3.3 KiB

  1. #ifndef __<%=name.toUpperCase()%>_H
  2. #define __<%=name.toUpperCase()%>_H
  3. #include <stdint.h>
  4. #define <%=name%>_N64 <%= n64 %>
  5. #define <%=name%>_SHORT 0x00000000
  6. #define <%=name%>_LONG 0x80000000
  7. #define <%=name%>_LONGMONTGOMERY 0xC0000000
  8. typedef struct __attribute__((__packed__)) {
  9. int32_t shortVal;
  10. uint32_t type;
  11. uint64_t longVal[<%=name%>_N64];
  12. } <%=name%>Element;
  13. typedef <%=name%>Element *P<%=name%>Element;
  14. extern <%=name%>Element <%=name%>_q;
  15. extern "C" void <%=name%>_copy(P<%=name%>Element r, P<%=name%>Element a);
  16. extern "C" void <%=name%>_copyn(P<%=name%>Element r, P<%=name%>Element a, int n);
  17. extern "C" void <%=name%>_add(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  18. extern "C" void <%=name%>_sub(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  19. extern "C" void <%=name%>_neg(P<%=name%>Element r, P<%=name%>Element a);
  20. extern "C" void <%=name%>_mul(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  21. extern "C" void <%=name%>_square(P<%=name%>Element r, P<%=name%>Element a);
  22. extern "C" void <%=name%>_band(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  23. extern "C" void <%=name%>_bor(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  24. extern "C" void <%=name%>_bxor(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  25. extern "C" void <%=name%>_bnot(P<%=name%>Element r, P<%=name%>Element a);
  26. extern "C" void <%=name%>_eq(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  27. extern "C" void <%=name%>_neq(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  28. extern "C" void <%=name%>_lt(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  29. extern "C" void <%=name%>_gt(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  30. extern "C" void <%=name%>_leq(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  31. extern "C" void <%=name%>_geq(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  32. extern "C" void <%=name%>_land(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  33. extern "C" void <%=name%>_lor(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  34. extern "C" void <%=name%>_lnot(P<%=name%>Element r, P<%=name%>Element a);
  35. extern "C" void <%=name%>_toNormal(P<%=name%>Element pE);
  36. extern "C" void <%=name%>_toLongNormal(P<%=name%>Element pE);
  37. extern "C" void <%=name%>_toMontgomery(P<%=name%>Element pE);
  38. extern "C" int <%=name%>_isTrue(P<%=name%>Element pE);
  39. extern "C" int <%=name%>_toInt(P<%=name%>Element pE);
  40. extern "C" void <%=name%>_fail();
  41. extern <%=name%>Element <%=name%>_q;
  42. // Pending functions to convert
  43. void <%=name%>_str2element(P<%=name%>Element pE, char const*s);
  44. char *<%=name%>_element2str(P<%=name%>Element pE);
  45. void <%=name%>_idiv(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  46. void <%=name%>_mod(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  47. void <%=name%>_inv(P<%=name%>Element r, P<%=name%>Element a);
  48. void <%=name%>_div(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  49. void <%=name%>_shl(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  50. void <%=name%>_shr(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  51. void <%=name%>_pow(P<%=name%>Element r, P<%=name%>Element a, P<%=name%>Element b);
  52. void <%=name%>_init();
  53. #endif // __<%=name.toUpperCase()%>_H