Coverage Report

Created: 2017-08-18 19:41

/Users/buildslave/jenkins/sharedspace/clang-stage2-coverage-R@2/llvm/tools/polly/lib/External/isl/isl_imath.c
Line
Count
Source (jump to first uncovered line)
1
#include <isl_int.h>
2
3
uint32_t isl_imath_hash(mp_int v, uint32_t hash)
4
262k
{
5
262k
  unsigned const char *data = (unsigned char *)v->digits;
6
262k
  unsigned const char *end = data + v->used * sizeof(v->digits[0]);
7
262k
8
262k
  if (v->sign == 1)
9
122k
    isl_hash_byte(hash, 0xFF);
10
2.96M
  for (; 
data < end2.96M
;
++data2.70M
)
11
2.70M
    isl_hash_byte(hash, *data);
12
262k
  return hash;
13
262k
}
14
15
/* Try a standard conversion that fits into a long.
16
 */
17
int isl_imath_fits_slong_p(mp_int op)
18
0
{
19
0
  long out;
20
0
  mp_result res = mp_int_to_int(op, &out);
21
0
  return res == MP_OK;
22
0
}
23
24
/* Try a standard conversion that fits into an unsigned long.
25
 */
26
int isl_imath_fits_ulong_p(mp_int op)
27
0
{
28
0
  unsigned long out;
29
0
  mp_result res = mp_int_to_uint(op, &out);
30
0
  return res == MP_OK;
31
0
}
32
33
void isl_imath_addmul_ui(mp_int rop, mp_int op1, unsigned long op2)
34
0
{
35
0
  mpz_t temp;
36
0
  mp_int_init(&temp);
37
0
38
0
  mp_int_set_uvalue(&temp, op2);
39
0
  mp_int_mul(op1, &temp, &temp);
40
0
  mp_int_add(rop, &temp, rop);
41
0
42
0
  mp_int_clear(&temp);
43
0
}
44
45
void isl_imath_submul_ui(mp_int rop, mp_int op1, unsigned long op2)
46
0
{
47
0
  mpz_t temp;
48
0
  mp_int_init(&temp);
49
0
50
0
  mp_int_set_uvalue(&temp, op2);
51
0
  mp_int_mul(op1, &temp, &temp);
52
0
  mp_int_sub(rop, &temp, rop);
53
0
54
0
  mp_int_clear(&temp);
55
0
}
56
57
/* Compute the division of lhs by a rhs of type unsigned long, rounding towards
58
 * positive infinity (Ceil).
59
 */
60
void isl_imath_cdiv_q_ui(mp_int rop, mp_int lhs, unsigned long rhs)
61
0
{
62
0
  mpz_t temp;
63
0
  mp_int_init(&temp);
64
0
65
0
  mp_int_set_uvalue(&temp, rhs);
66
0
  impz_cdiv_q(rop, lhs, &temp);
67
0
68
0
  mp_int_clear(&temp);
69
0
}
70
71
/* Compute the division of lhs by a rhs of type unsigned long, rounding towards
72
 * negative infinity (Floor).
73
 */
74
void isl_imath_fdiv_q_ui(mp_int rop, mp_int lhs, unsigned long rhs)
75
0
{
76
0
  mpz_t temp;
77
0
  mp_int_init(&temp);
78
0
79
0
  mp_int_set_uvalue(&temp, rhs);
80
0
  impz_fdiv_q(rop, lhs, &temp);
81
0
82
0
  mp_int_clear(&temp);
83
0
}