示例#1
0
static mpz_t *
mp_new()
{
	mpz_t	   *mp = mp_int_alloc();

	mp_int_init_size(mp, 256);
	return mp;
}
示例#2
0
mp_int alloc_values(int nt, int prec)
{
  mp_int out = malloc(nt * sizeof(mpz_t));
  int i;

  if(out == NULL)
    return NULL;

  for(i = 0; i < nt; ++i) {
    if(mp_int_init_size(out + i, prec) != MP_OK) {
      while(--i >= 0)
	mp_int_clear(out + i);
      return NULL;
    }
  }
  
  return out;
}