explicitly mark deprecated functions as deprecated
[isl.git] / isl_int_gmp.h
blob263b32c66f25907c4ae41839710b8fda20a41095
1 #ifndef ISL_INT_GMP_H
2 #define ISL_INT_GMP_H
4 #include <gmp.h>
6 /* isl_int is the basic integer type, implemented with GMP's mpz_t. In the
7 * future, different types such as long long or cln::cl_I will be supported.
8 */
9 typedef mpz_t isl_int;
11 #define isl_int_init(i) mpz_init(i)
12 #define isl_int_clear(i) mpz_clear(i)
14 #define isl_int_set(r,i) mpz_set(r,i)
15 #define isl_int_set_si(r,i) mpz_set_si(r,i)
16 #define isl_int_set_ui(r,i) mpz_set_ui(r,i)
17 #define isl_int_fits_slong(r) mpz_fits_slong_p(r)
18 #define isl_int_get_si(r) mpz_get_si(r)
19 #define isl_int_fits_ulong(r) mpz_fits_ulong_p(r)
20 #define isl_int_get_ui(r) mpz_get_ui(r)
21 #define isl_int_get_d(r) mpz_get_d(r)
22 #define isl_int_get_str(r) mpz_get_str(0, 10, r)
23 #define isl_int_abs(r,i) mpz_abs(r,i)
24 #define isl_int_neg(r,i) mpz_neg(r,i)
25 #define isl_int_swap(i,j) mpz_swap(i,j)
26 #define isl_int_swap_or_set(i,j) mpz_swap(i,j)
27 #define isl_int_add_ui(r,i,j) mpz_add_ui(r,i,j)
28 #define isl_int_sub_ui(r,i,j) mpz_sub_ui(r,i,j)
30 #define isl_int_add(r,i,j) mpz_add(r,i,j)
31 #define isl_int_sub(r,i,j) mpz_sub(r,i,j)
32 #define isl_int_mul(r,i,j) mpz_mul(r,i,j)
33 #define isl_int_mul_2exp(r,i,j) mpz_mul_2exp(r,i,j)
34 #define isl_int_mul_si(r,i,j) mpz_mul_si(r,i,j)
35 #define isl_int_mul_ui(r,i,j) mpz_mul_ui(r,i,j)
36 #define isl_int_pow_ui(r,i,j) mpz_pow_ui(r,i,j)
37 #define isl_int_addmul(r,i,j) mpz_addmul(r,i,j)
38 #define isl_int_addmul_ui(r,i,j) mpz_addmul_ui(r,i,j)
39 #define isl_int_submul(r,i,j) mpz_submul(r,i,j)
40 #define isl_int_submul_ui(r,i,j) mpz_submul_ui(r,i,j)
42 #define isl_int_gcd(r,i,j) mpz_gcd(r,i,j)
43 #define isl_int_lcm(r,i,j) mpz_lcm(r,i,j)
44 #define isl_int_divexact(r,i,j) mpz_divexact(r,i,j)
45 #define isl_int_divexact_ui(r,i,j) mpz_divexact_ui(r,i,j)
46 #define isl_int_tdiv_q(r,i,j) mpz_tdiv_q(r,i,j)
47 #define isl_int_cdiv_q(r,i,j) mpz_cdiv_q(r,i,j)
48 #define isl_int_fdiv_q(r,i,j) mpz_fdiv_q(r,i,j)
49 #define isl_int_fdiv_r(r,i,j) mpz_fdiv_r(r,i,j)
50 #define isl_int_fdiv_q_ui(r,i,j) mpz_fdiv_q_ui(r,i,j)
52 #define isl_int_read(r,s) mpz_set_str(r,s,10)
53 #define isl_int_sgn(i) mpz_sgn(i)
54 #define isl_int_cmp(i,j) mpz_cmp(i,j)
55 #define isl_int_cmp_si(i,si) mpz_cmp_si(i,si)
56 #define isl_int_eq(i,j) (mpz_cmp(i,j) == 0)
57 #define isl_int_ne(i,j) (mpz_cmp(i,j) != 0)
58 #define isl_int_lt(i,j) (mpz_cmp(i,j) < 0)
59 #define isl_int_le(i,j) (mpz_cmp(i,j) <= 0)
60 #define isl_int_gt(i,j) (mpz_cmp(i,j) > 0)
61 #define isl_int_ge(i,j) (mpz_cmp(i,j) >= 0)
62 #define isl_int_abs_eq(i,j) (mpz_cmpabs(i,j) == 0)
63 #define isl_int_abs_ne(i,j) (mpz_cmpabs(i,j) != 0)
64 #define isl_int_abs_lt(i,j) (mpz_cmpabs(i,j) < 0)
65 #define isl_int_abs_gt(i,j) (mpz_cmpabs(i,j) > 0)
66 #define isl_int_abs_ge(i,j) (mpz_cmpabs(i,j) >= 0)
67 #define isl_int_is_divisible_by(i,j) mpz_divisible_p(i,j)
69 uint32_t isl_gmp_hash(mpz_t v, uint32_t hash);
70 #define isl_int_hash(v,h) isl_gmp_hash(v,h)
72 #ifndef mp_get_memory_functions
73 void mp_get_memory_functions(
74 void *(**alloc_func_ptr) (size_t),
75 void *(**realloc_func_ptr) (void *, size_t, size_t),
76 void (**free_func_ptr) (void *, size_t));
77 #endif
79 typedef void (*isl_int_print_mp_free_t)(void *, size_t);
80 #define isl_int_free_str(s) \
81 do { \
82 isl_int_print_mp_free_t mp_free; \
83 mp_get_memory_functions(NULL, NULL, &mp_free); \
84 (*mp_free)(s, strlen(s) + 1); \
85 } while (0)
87 #endif /* ISL_INT_GMP_H */