add isl_schedule_node_get_subtree_expansion
[isl.git] / isl_imath.c
blob959b5e78272de36590615cb32dc2b6c778171ba5
1 #include <isl_int.h>
3 uint32_t isl_imath_hash(mp_int v, uint32_t hash)
5 unsigned const char *data = (unsigned char *)v->digits;
6 unsigned const char *end = data + v->used * sizeof(v->digits[0]);
8 if (v->sign == 1)
9 isl_hash_byte(hash, 0xFF);
10 for (; data < end; ++data)
11 isl_hash_byte(hash, *data);
12 return hash;
15 /* Try a standard conversion that fits into a long.
17 int isl_imath_fits_slong_p(mp_int op)
19 unsigned long out;
20 mp_result res = mp_int_to_int(op, &out);
21 return res == MP_OK;
24 /* Try a standard conversion that fits into an unsigned long.
26 int isl_imath_fits_ulong_p(mp_int op)
28 unsigned long out;
29 mp_result res = mp_int_to_uint(op, &out);
30 return res == MP_OK;
33 void isl_imath_addmul_ui(mp_int rop, mp_int op1, unsigned long op2)
35 isl_int temp;
36 isl_int_init(temp);
38 isl_int_set_ui(temp, op2);
39 isl_int_addmul(rop, op1, temp);
41 isl_int_clear(temp);
44 void isl_imath_submul_ui(mp_int rop, mp_int op1, unsigned long op2)
46 isl_int temp;
47 isl_int_init(temp);
49 isl_int_set_ui(temp, op2);
50 isl_int_submul(rop, op1, temp);
52 isl_int_clear(temp);