#ifndef _CSTD_INCLUDE1#define _CSTD_INCLUDE23#include "gmp.h"45/*6Copyright 2007 Andrew V. Sutherland78This file is part of smalljac.910smalljac is free software: you can redistribute it and/or modify11it under the terms of the GNU General Public License as published by12the Free Software Foundation, either version 2 of the License, or13(at your option) any later version.1415smalljac is distributed in the hope that it will be useful,16but WITHOUT ANY WARRANTY; without even the implied warranty of17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18GNU General Public License for more details.1920You should have received a copy of the GNU General Public License21along with smalljac. If not, see <http://www.gnu.org/licenses/>.22*/2324// General utility items that potentially could be used by any module2526#define DEBUG_LEVEL 227#define INFO_LEVEL 128#define WARN_LEVEL -129#define ERROR_LEVEL -230#define OUTPUT_LEVEL 03132int dbg_level;3334#define dbg_setlevel(i) (dbg_level = (i))35#define dbg_printf if ( dbg_level >= DEBUG_LEVEL ) gmp_printf36#define info_printf if ( dbg_level >= INFO_LEVEL ) gmp_printf37#define warn_printf if ( dbg_level >= WARN_LEVEL ) gmp_printf38#define err_printf if ( dbg_level >= ERROR_LEVEL ) gmp_printf39#define out_printf if ( dbg_level >= OUTPUT_LEVEL ) gmp_printf4041#define delta_msecs(s,t) (1000UL*(t-s)/CLOCKS_PER_SEC)42#define delta_nsecs(s,t) (1000000000UL*(t-s)/CLOCKS_PER_SEC) // assumes 64 bit UL43#define delta_secs(s,t) ((double)(t-s)/CLOCKS_PER_SEC)44#define delta_wall_msecs(w1,w2) (1000*((w2)->tv_sec - (w1)->tv_sec) + ((w2)->tv_usec - (w1)->tv_usec)/1000)4546// Centralized memory allocation to aid debugging.47// mem_alloc will never fail (it aborts on errors) and zero-fills all allocated memory.48void *mem_alloc (unsigned long bytes);49void mem_free (void *ptr);5051#define my_mpz_init(z) { puts ("mpz_init"); mpz_init(z); }52#define my_mpz_clear(z) { puts ("mpz_clear"); mpz_clear(z); }5354#endif555657