source: git/factory/gmpext.h @ 767da0

spielwiese
Last change on this file since 767da0 was ef4ae2, checked in by Hans Schoenemann <hannes@…>, 4 years ago
opt: factory (mpz_init, is_imm, moved tests out of loops(addTermList) etc
  • Property mode set to 100644
File size: 504 bytes
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_GMPEXT_H
4#define INCL_GMPEXT_H
5
6/**
7 * @file gmpext.h
8 *
9 * utility functions for gmp
10**/
11
12// #include "config.h"
13
14#include "cf_defs.h"
15#include "imm.h"
16
17
18inline bool
19mpz_is_imm( const mpz_t mpi )
20{
21  if (mpi->_mp_size==0)
22    return true;
23  if ((mpi->_mp_size>1)||(mpi->_mp_size< -1))
24    return false;
25  return ( mpz_cmp_si( mpi, MINIMMEDIATE ) >= 0 ) &&
26        ( mpz_cmp_si( mpi, MAXIMMEDIATE ) <= 0 );
27}
28
29#endif /* ! INCL_GMPEXT_H */
Note: See TracBrowser for help on using the repository browser.