Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays in GMP

Status
Not open for further replies.

gijunior

Programmer
Feb 2, 2006
21
0
0
GB
an someone please help me with this. I have read the manual and I just dont get how to create a dynamic array.


normally id do -
Code:
int *p;
int elements;
elements = /*changes everytime*/
p = calloc(elements, sizeof(int));


but with the GMP im stuck with simple initialisation

Code:
void mpz_array_init (mpz t integer_array [], size t array_size,
mp size t fixed_num_bits )


i can't find anything explanitary about the args for above function.


Can anyone help, or do they have a bit of code they have used to corroborate the little i understand from the manual?

Muchos thanks
 
This is just pure guesswork: I don't have a GMP manual, but as a hacker, this is what I'd do. Maybe you shouldn't create an array of int. It is probably something like
Code:
mpz_t* p;
size_t elements;
mp_size_t bits;

elements = /* whatever */
bits = /* whatever */
p = calloc (elements, sizeof (mpz_t));
mpz_array_init (p, elements, bits);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top