示例#1
0
文件: inf_div.c 项目: k6s/tek1
char		do_div(t_nb *res, t_nb *n1, t_nb *n2, t_base *s_base)
{
  t_nb		*tmp;
  t_nb		*to_free;
  int		cmp;

  if (!(tmp = mk_zero(s_base->base[0])))
    return (-1);
  cmp = 0;
  while (n1->len > tmp->len
	 || (tmp->len == n1->len
	     && (cmp = my_memcmp(tmp->nb, n1->nb, n1->len)) < 0))
    {
      add_one(res, n1->len, s_base->base_len);
      to_free = tmp;
      if (!(tmp = inf_add(tmp, n2, s_base, 0)))
	return (-1);
      free(to_free->nb);
      free(to_free);
    }
  if (n1->len < tmp->len || cmp > 0)
    sub_one(res, n1->len, s_base->base_len);
  free(tmp->nb);
  free(tmp);
  return (0);
}
示例#2
0
void macro_util::mk_add(unsigned num_args, expr * const * args, sort * s, expr_ref & r) const {
    if (num_args == 0) {
        r = mk_zero(s);
        return;
    }
    poly_simplifier_plugin * ps = get_poly_simp_for(s);
    ps->set_curr_sort(s);
    ps->mk_add(num_args, args, r);
}