4 "#include \"sqrtinit.h\"\
6 \nuint64_t rsa_estimate (uint64_t a) {\
7 \n uint64_t abits, x0;\
9 \n x0 = 0x100 | invsqrttab[abits - 0x80];\
14 syntax val rsa_estimate "rsa_estimate"
18 blacklist "invsqrttab"
23 "\n#include \"binverttab.h\"\
25 \nuint64_t binvert_limb_table (uint64_t n) {\
26 \n return (uint64_t)binverttab[n];\
29 syntax val binvert_limb_table "binvert_limb_table"
33 blacklist "binverttab"
35 module mach.int.UInt64GMP
37 \ntypedef unsigned __int128 uint128_t;\
39 \nstruct __mul64_double_result {\
40 \n uint64_t __field_0;\
41 \n uint64_t __field_1;\
44 \nstatic inline struct __mul64_double_result\
45 \nmul64_double(uint64_t x, uint64_t y)\
47 \n uint128_t z = (uint128_t)x * (uint128_t)y;\
48 \n struct __mul64_double_result result = { z, z >> 64 };\
52 \nstatic inline uint64_t\
53 \ndiv64_2by1(uint64_t ul, uint64_t uh, uint64_t d)\
55 \n return (((uint128_t)uh << 64) | ul) / d;\
59 syntax val mul_double "mul64_double"
60 syntax val div2by1 "div64_2by1"
64 blacklist "mul64_double" "div64_2by1"
69 \nstruct __open_sep_result {\
70 \n uint64_t *__field_0;\
71 \n uint64_t *__field_1;\
72 \n uint64_t *__field_2;\
75 \nstruct __open_rx_result {\
76 \n uint64_t *__field_0;\
77 \n uint64_t *__field_1;\
78 \n uint64_t *__field_2;\
81 \nstruct __open_shift_sep_result {\
82 \n uint64_t *__field_0;\
83 \n uint64_t *__field_1;\
86 \nstatic inline struct __open_sep_result\
87 \nopen_sep (uint64_t *r, uint64_t *x, uint64_t *y)\
89 \n struct __open_sep_result result;\
90 \n result.__field_0 = r;\
91 \n result.__field_1 = x;\
92 \n result.__field_2 = y;\
96 \nstatic inline struct __open_rx_result\
97 \nopen_rx (uint64_t *x, uint64_t *y)\
99 \n struct __open_rx_result result;\
100 \n result.__field_0 = x;\
101 \n result.__field_1 = x;\
102 \n result.__field_2 = y;\
106 \nstatic inline struct __open_shift_sep_result\
107 \nopen_shift_sep (uint64_t *r, uint64_t *x)\
109 \n struct __open_shift_sep_result result;\
110 \n result.__field_0 = r;\
111 \n result.__field_1 = x;\
116 syntax val open_sep "open_sep"
117 syntax val open_rx "open_rx"
118 syntax val open_shift_sep "open_shift_sep"
119 syntax val close_sep "IGNORE3(%1, %2, %3)" prec 1 15 15 15
120 syntax val close_rx "IGNORE2(%1, %2)" prec 1 15 15
121 syntax val close_shift_sep "IGNORE2(%1, %2)" prec 1 15 15
135 \ntypedef __wmpz_struct *wmpz_ptr;\
136 \ntypedef __wmpz_struct wmpz_t[1];\
138 \n#define SIZ(x) ((x)->_size)\
139 \n#define ALLOC(x) ((x)->_alloc)\
140 \n#define PTR(x) ((x)->_ptr)\
144 syntax type mpz_ptr "wmpz_ptr"
145 syntax type mpz_struct "__wmpz_struct"
146 syntax val mpz_eq "%1 == %2" prec 7 15 14
147 syntax val size_of "SIZ(%1)" prec 1 15
148 syntax val alloc_of "ALLOC(%1)" prec 1 15
154 "\nvoid __wmpz_init (wmpz_ptr x) {\
157 \n PTR(x) = malloc(sizeof(uint64_t));\
163 "\nvoid wmpz_clear (wmpz_ptr x)\
169 void __wmpz_init (wmpz_ptr);\
170 \nvoid wmpz_clear (wmpz_ptr);\
173 syntax val set_size "SIZ(%1) = %2" prec 14 15 14
174 syntax val set_size_0 "SIZ(%1) = 0" prec 14 15
175 syntax val wmpz_minus "SIZ(%1) = -SIZ(%1)" prec 14 15 15
176 syntax val set_alloc "ALLOC(%1) = %2" prec 14 15 14
177 syntax val set_ptr "PTR(%1) = %2" prec 14 15 14
178 syntax val get_read_ptr "PTR(%1)" prec 1 15
179 syntax val get_write_ptr "PTR(%1)" prec 1 15
180 syntax val release_reader "(void)(%1)" prec 2 15
181 syntax val release_writer "(void)(%1)" prec 2 15
182 syntax val wmpz_init "__wmpz_init" prec 2
183 syntax val wmpz_tmp_decl "{ 0, 0, NULL }" prec 2
184 syntax val wmpz_struct_to_ptr "&%1" prec 2 2
185 syntax val wmpz_clear "wmpz_clear" prec 2
189 blacklist "__wmpz_init"
199 module types.UInt64Eq
203 module logical.LogicalUtil