change mechanism for detecting stdint.h

This commit is contained in:
gladman 2011-03-19 09:28:07 +00:00
parent 57d37eea1d
commit 9abe9eded1
9 changed files with 15 additions and 25 deletions

View File

@ -53,14 +53,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#endif
#undef __need_size_t
#ifdef HAVE_STDINT_H
#if defined (__cplusplus)
# include <cstdint> /* for intmax_t/uintmax_t */
# else
# include <stdint.h> /* for intmax_t/uintmax_t */
# endif
#endif
/* Instantiated by configure. */
#if ! defined (__GMP_WITHIN_CONFIGURE)
@DEFN_LONG_LONG_LIMB@
@ -1188,7 +1180,7 @@ __GMP_DECLSPEC void mpz_xor __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
/****** Integer (i.e. Z) routines for intmaax_t/uintmax_t types ******/
#ifdef HAVE_STDINT_H
#if defined( _STDINT_H ) || defined ( _STDINT_H_ ) || defined ( _STDINT )
#define __GMP_BITS_PER_UINTMAX (8*sizeof(uintmax_t))

View File

@ -21,7 +21,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define HAVE_STDINT_H
#include <stdint.h>
#include "mpir.h"
#include "gmp-impl.h"
@ -33,7 +33,7 @@ MA 02110-1301, USA. */
intmax_t
mpz_get_sx (mpz_srcptr z)
{
#if GMP_NUMB_BITS >= 8 * SIZEOF_UINTMAX_T
#if NLIMBS == 1
uintmax_t v = (intmax_t)(z->_mp_size ? z->_mp_d[0] : 0);
#else
uintmax_t v = 0, n = MIN(NLIMBS, ABS(z->_mp_size));

View File

@ -21,7 +21,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define HAVE_STDINT_H
#include <stdint.h>
#include "mpir.h"
#include "gmp-impl.h"
@ -33,7 +33,7 @@ MA 02110-1301, USA. */
uintmax_t
mpz_get_ux (mpz_srcptr z)
{
#if GMP_NUMB_BITS >= 8 * SIZEOF_UINTMAX_T
#if NLIMBS == 1
return (uintmax_t)(z->_mp_size ? z->_mp_d[0] : 0);
#else
uintmax_t v = 0, n = MIN(NLIMBS, ABS(z->_mp_size));

View File

@ -20,7 +20,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define HAVE_STDINT_H
#include <stdint.h>
#include "mpir.h"
#include "gmp-impl.h"
@ -36,7 +36,7 @@ mpz_init_set_sx (mpz_ptr z, intmax_t v)
z->_mp_d = (mp_ptr) (*__gmp_allocate_func) (MAX(1, NLIMBS) * BYTES_PER_MP_LIMB);
z->_mp_alloc = MAX(1, NLIMBS);
#if GMP_NUMB_BITS >= 8 * SIZEOF_UINTMAX_T
#if NLIMBS == 1
z->_mp_d[0] = (mp_limb_t)uv;
z->_mp_size = v < 0 ? -NLIMBS : v ? NLIMBS : 0;
#else

View File

@ -20,7 +20,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define HAVE_STDINT_H
#include <stdint.h>
#include "mpir.h"
#include "gmp-impl.h"
@ -36,7 +36,7 @@ mpz_init_set_ux (mpz_ptr z, uintmax_t v)
z->_mp_d = (mp_ptr) (*__gmp_allocate_func) (MAX(1, NLIMBS) * BYTES_PER_MP_LIMB);
z->_mp_alloc = MAX(1, NLIMBS);
#if GMP_NUMB_BITS >= 8 * SIZEOF_UINTMAX_T
#if NLIMBS == 1
z->_mp_d[0] = (mp_limb_t)v;
z->_mp_size = (v ? NLIMBS : 0);
#else

View File

@ -20,7 +20,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define HAVE_STDINT_H
#include <stdint.h>
#include "mpir.h"
#include "gmp-impl.h"
@ -33,7 +33,7 @@ void
mpz_set_sx (mpz_ptr z, intmax_t v)
{ uintmax_t i, uv = (v < 0 ? -v : v);
#if GMP_NUMB_BITS >= 8 * SIZEOF_UINTMAX_T
#if NLIMBS == 1
z->_mp_d[0] = (mp_limb_t)uv;
z->_mp_size = v < 0 ? -NLIMBS : v ? NLIMBS : 0;
#else

View File

@ -20,7 +20,7 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define HAVE_STDINT_H
#include <stdint.h>
#include "mpir.h"
#include "gmp-impl.h"
@ -33,7 +33,7 @@ void
mpz_set_ux (mpz_ptr z, uintmax_t v)
{ uintmax_t i, uv;
#if GMP_NUMB_BITS >= 8 * SIZEOF_UINTMAX_T
#if NLIMBS == 1
z->_mp_d[0] = (mp_limb_t)v;
z->_mp_size = (v ? NLIMBS : 0);
#else

View File

@ -21,10 +21,9 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define HAVE_STDINT_H
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "mpir.h"
#include "gmp-impl.h"
#include "tests.h"

View File

@ -20,10 +20,9 @@ along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#define HAVE_STDINT_H
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "mpir.h"
#include "gmp-impl.h"
#include "tests.h"