buildtools/gcc/mpc/tests/init_parameters.c
Niels Sascha Reedijk 92b3138b83 Import GCC 13.1.0 and dependencies
Updated dependencies:
 * GMP 6.2.1
 * ISL 0.24
 * MPL 1.2.1
 * MPFR 4.1.0

The dependencies were pulled in by running the ./contrib/download_prerequisites script and then
manually removing the symbolic links and archives, and renaming the directories (i.e mv isl-0.24 to isl)
2023-06-18 01:43:18 +01:00

85 lines
1.8 KiB
C

/* init_parameters -- Allocate memory for function parameters.
Copyright (C) 2012, 2014 INRIA
This file is part of GNU MPC.
GNU MPC is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
GNU MPC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see http://www.gnu.org/licenses/ .
*/
#include <stdio.h>
#include "mpc-tests.h"
static void
init_param (mpc_operand_t* p, mpc_param_t t)
{
switch (t)
{
case NATIVE_INT:
case NATIVE_UL:
case NATIVE_L:
case NATIVE_D:
break;
case GMP_Z:
mpz_init (p->mpz);
break;
case GMP_Q:
mpq_init (p->mpq);
break;
case GMP_F:
mpf_init (p->mpf);
break;
case MPFR_INEX:
break;
case MPFR:
mpfr_init2 (p->mpfr, 512);
break;
case MPC_INEX:
case MPCC_INEX:
break;
case MPC:
mpc_init2 (p->mpc, 512);
break;
case MPFR_RND:
case MPC_RND:
break;
default:
fprintf (stderr, "init_parameters: unsupported type.\n");
exit (1);
}
}
void
init_parameters (mpc_fun_param_t *params)
{
int in, out;
int total = params->nbout + params->nbin;
for (out = 0; out < params->nbout; out++)
{
init_param (&(params->P[out]), params->T[out]);
init_param (&(params->P[total + out]), params->T[total + out]);
}
for (in = params->nbout; in < total; in++)
{
init_param (&(params->P[in]), params->T[in]);
}
}