fmpzio.h (917B)
1 #ifndef _FMPZIO_H_ 2 #define _FMPZIO_H_ 3 4 #include <assert.h> 5 #include <err.h> 6 #include <fmpz.h> 7 #include <fmpz_vec.h> 8 #include <stdio.h> 9 #include <stdlib.h> 10 #include <string.h> 11 12 /** 13 * Read next fmpz from stdin (in base 10). 14 * 15 * @param res the fmpz_t to write result to. 16 * @returns 0 if string could be read, -1 otherwise. 17 */ 18 int read_next_fmpz(fmpz_t res); 19 20 /** 21 * Read the next fmpz in hexadecimal from stdin. 22 * 23 * @param res the fmpz_t to write result to. 24 * @returns 0 if string could be read, -1 otherwise. 25 */ 26 int read_next_hex_fmpz(fmpz_t res); 27 28 /** 29 * Read a fmpz vector from stdin. 30 * 31 * The numbers are read from stdin, separated by whitespaces (spaces, 32 * tabs and newlines). Returns the size of the resulting vector. 33 * Allocates a new vector which needs to be cleared. 34 * 35 * @param v pointer to vector to initialize 36 * @returns the length of the new vector 37 */ 38 slong read_hex_lines(fmpz **v); 39 40 #endif