1 | |
2 | void test_mpz_export(char **out, char *rop, size_t *countp, int order, |
3 | size_t size, int endian, size_t nails, char *mpzstr) { |
4 | mpz_t op; |
5 | mpz_init(op); |
6 | mpz_set_str(op, mpzstr, 10); |
7 | // printf("%p,%p,%d,%zi,%d,%zi,%s\n", rop, countp, order, size, endian, nails, |
8 | // mpzstr); |
9 | *out = mpz_export(rop, countp, order, size, endian, nails, op); |
10 | } |
11 | |
12 | void test_mpz_import(char *out, void *unused, size_t count, int order, |
13 | size_t size, int endian, size_t nails, char *mpzstr) { |
14 | mpz_t op; |
15 | mpz_t rop; |
16 | mpz_init(op); |
17 | mpz_init(rop); |
18 | mpz_set_str(op, mpzstr, 10); |
19 | char *data; |
20 | |
21 | // printf("%p,%p,%d,%zi,%d,%zi,%s\n", rop, countp, order, size, endian, nails, |
22 | // mpzstr); |
23 | data = mpz_export(NULL, &count, order, size, endian, nails, op); |
24 | mpz_import(rop, count, order, size, endian, nails, data); |
25 | int eq = mpz_cmpabs(op, rop); |
26 | sprintf(out, "%2d:" , eq); |
27 | mpz_get_str(out + 3, 10, rop); |
28 | } |
29 | |