00001 // Copyright (C) 2011 CNRS - Ecole Polytechnique - INRIA. 00002 // 00003 // This file is part of TIFA. 00004 // 00005 // TIFA is free software; you can redistribute it and/or modify it under the 00006 // terms of the GNU Lesser General Public License as published by the Free 00007 // Software Foundation; either version 2.1 of the License, or (at your option) 00008 // any later version. 00009 // 00010 // TIFA is distributed in the hope that it will be useful, but WITHOUT ANY 00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00013 // more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, 00017 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00030 #if !defined(_TIFA_GMP_UTILS_H_) 00031 00035 #define _TIFA_GMP_UTILS_H_ 00036 00037 #ifdef __cplusplus 00038 extern "C" { 00039 #endif 00040 00041 #include <gmp.h> 00042 #include "hashtable.h" 00043 00050 struct struct_mpz_pair_t { 00054 mpz_t x; 00058 mpz_t y; 00059 }; 00060 00065 typedef struct struct_mpz_pair_t mpz_pair_t; 00066 00075 inline static void init_mpz_pair(mpz_pair_t* pair) { 00076 mpz_init(pair->x); 00077 mpz_init(pair->y); 00078 } 00079 00087 inline static void clear_mpz_pair(mpz_pair_t* pair) { 00088 mpz_clear(pair->x); 00089 mpz_clear(pair->y); 00090 } 00091 00100 void empty_mpzpair_htable(hashtable_t* const htable); 00101 00111 inline static void free_mpzpair_htable(hashtable_t* htable) { 00112 empty_mpzpair_htable(htable); 00113 free_hashtable(htable); 00114 } 00115 00126 float mpz_log10(mpz_t n); 00127 00128 #ifdef __cplusplus 00129 } 00130 #endif 00131 00132 #endif