8 #if defined(__cplusplus)
12 /* isl_int is the basic integer type. It currently always corresponds
13 * to a gmp mpz_t, but in the future, different types such as long long
14 * or cln::cl_I will be supported.
16 typedef mpz_t isl_int;
18 #define isl_int_init(i) mpz_init(i)
19 #define isl_int_clear(i) mpz_clear(i)
21 #define isl_int_set(r,i) mpz_set(r,i)
22 #define isl_int_set_si(r,i) mpz_set_si(r,i)
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_addmul(r,i,j) mpz_addmul(r,i,j)
34 #define isl_int_submul(r,i,j) mpz_submul(r,i,j)
36 #define isl_int_gcd(r,i,j) mpz_gcd(r,i,j)
37 #define isl_int_lcm(r,i,j) mpz_lcm(r,i,j)
38 #define isl_int_divexact(r,i,j) mpz_divexact(r,i,j)
39 #define isl_int_cdiv_q(r,i,j) mpz_cdiv_q(r,i,j)
40 #define isl_int_fdiv_q(r,i,j) mpz_fdiv_q(r,i,j)
42 #define isl_int_print(out,i) \
45 void (*gmp_free) (void *, size_t); \
46 s = mpz_get_str(0, 10, i); \
47 fprintf(out, "%s", s); \
48 mp_get_memory_functions(NULL, NULL, &gmp_free); \
49 (*gmp_free)(s, strlen(s)+1); \
52 #define isl_int_sgn(i) mpz_sgn(i)
53 #define isl_int_cmp_si(i,si) mpz_cmp_si(i,si)
54 #define isl_int_eq(i,j) (mpz_cmp(i,j) == 0)
55 #define isl_int_ne(i,j) (mpz_cmp(i,j) != 0)
56 #define isl_int_lt(i,j) (mpz_cmp(i,j) < 0)
57 #define isl_int_abs_eq(i,j) (mpz_cmpabs(i,j) == 0)
58 #define isl_int_abs_ne(i,j) (mpz_cmpabs(i,j) != 0)
59 #define isl_int_abs_lt(i,j) (mpz_cmpabs(i,j) < 0)
62 #define isl_int_is_zero(i) (isl_int_sgn(i) == 0)
63 #define isl_int_is_one(i) (isl_int_cmp_si(i,1) == 0)
64 #define isl_int_is_negone(i) (isl_int_cmp_si(i,-1) == 0)
65 #define isl_int_is_pos(i) (isl_int_sgn(i) > 0)
66 #define isl_int_is_neg(i) (isl_int_sgn(i) < 0)
67 #define isl_int_is_nonpos(i) (isl_int_sgn(i) <= 0)
68 #define isl_int_is_nonneg(i) (isl_int_sgn(i) >= 0)
69 #define isl_int_is_divisible_by(i,j) mpz_divisible_p(i,j)
71 #define isl_int_hash(v,h) isl_gmp_hash(v,h)
73 #if defined(__cplusplus)