1 /* mp-h.in -- Definitions for the GNU multiple precision library -*-mode:c-*-
2 BSD mp compatible functions.
4 Copyright 1991, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004 Free Software
7 This file is part of the GNU MP Library.
9 The GNU MP Library is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or (at your
12 option) any later version.
14 The GNU MP Library is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
25 /* The following (everything under ifndef __GNU_MP__) must be identical in
26 gmp.h and mp.h to allow both to be included in an application or during
27 the library build. Use the t-gmp-mp-h.pl script to check. */
31 #define __need_size_t /* tell gcc stddef.h we only want size_t */
32 #if defined (__cplusplus)
33 #include <cstddef> /* for size_t */
35 #include <stddef.h> /* for size_t */
39 /* The following instantiated by configure, for internal use only */
40 #if ! defined (__GMP_WITHIN_CONFIGURE)
41 /* #undef _LONG_LONG_LIMB */
42 #define __GMP_LIBGMP_DLL 0
45 #if defined (__STDC__) \
46 || defined (__cplusplus) \
49 || (defined (__mips) && defined (_SYSTYPE_SVR4)) \
50 || defined (_MSC_VER) \
52 #define __GMP_HAVE_CONST 1
53 #define __GMP_HAVE_PROTOTYPES 1
54 #define __GMP_HAVE_TOKEN_PASTE 1
56 #define __GMP_HAVE_CONST 0
57 #define __GMP_HAVE_PROTOTYPES 0
58 #define __GMP_HAVE_TOKEN_PASTE 0
63 #define __gmp_const const
64 #define __gmp_signed signed
70 #if defined (__GNUC__)
71 #define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__)
72 #define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__)
74 #if defined (_MSC_VER) || defined (__BORLANDC__)
75 #define __GMP_DECLSPEC_EXPORT __declspec(dllexport)
76 #define __GMP_DECLSPEC_IMPORT __declspec(dllimport)
79 #define __GMP_DECLSPEC_EXPORT __export
80 #define __GMP_DECLSPEC_IMPORT __import
83 #define __GMP_DECLSPEC_EXPORT _Export
84 #define __GMP_DECLSPEC_IMPORT _Import
89 #define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
91 #define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
94 #define __GMP_DECLSPEC
97 #ifdef __GMP_SHORT_LIMB
98 typedef unsigned int mp_limb_t
;
99 typedef int mp_limb_signed_t
;
101 #ifdef _LONG_LONG_LIMB
102 typedef unsigned long long int mp_limb_t
;
103 typedef long long int mp_limb_signed_t
;
105 typedef unsigned long int mp_limb_t
;
106 typedef long int mp_limb_signed_t
;
109 typedef unsigned long int mp_bitcnt_t
;
113 int _mp_alloc
; /* Number of *limbs* allocated and pointed
114 to by the _mp_d field. */
115 int _mp_size
; /* abs(_mp_size) is the number of limbs the
116 last field points to. If _mp_size is
117 negative this is a negative number. */
118 mp_limb_t
*_mp_d
; /* Pointer to the limbs. */
121 #endif /* __GNU_MP__ */
123 /* User-visible types. */
124 typedef __mpz_struct MINT
;
127 #if __GMP_HAVE_PROTOTYPES
128 #define __GMP_PROTO(x) x
130 #define __GMP_PROTO(x) ()
133 #if defined (__cplusplus)
137 #define mp_set_memory_functions __gmp_set_memory_functions
138 __GMP_DECLSPEC
void mp_set_memory_functions
__GMP_PROTO ((void *(*) (size_t),
139 void *(*) (void *, size_t, size_t),
140 void (*) (void *, size_t)));
141 __GMP_DECLSPEC MINT
*itom
__GMP_PROTO ((signed short int));
142 __GMP_DECLSPEC MINT
*xtom
__GMP_PROTO ((const char *));
143 __GMP_DECLSPEC
void move
__GMP_PROTO ((const MINT
*, MINT
*));
144 __GMP_DECLSPEC
void madd
__GMP_PROTO ((const MINT
*, const MINT
*, MINT
*));
145 __GMP_DECLSPEC
void msub
__GMP_PROTO ((const MINT
*, const MINT
*, MINT
*));
146 __GMP_DECLSPEC
void mult
__GMP_PROTO ((const MINT
*, const MINT
*, MINT
*));
147 __GMP_DECLSPEC
void mdiv
__GMP_PROTO ((const MINT
*, const MINT
*, MINT
*, MINT
*));
148 __GMP_DECLSPEC
void sdiv
__GMP_PROTO ((const MINT
*, signed short int, MINT
*, signed short int *));
149 __GMP_DECLSPEC
void msqrt
__GMP_PROTO ((const MINT
*, MINT
*, MINT
*));
150 __GMP_DECLSPEC
void pow
__GMP_PROTO ((const MINT
*, const MINT
*, const MINT
*, MINT
*));
151 __GMP_DECLSPEC
void rpow
__GMP_PROTO ((const MINT
*, signed short int, MINT
*));
152 __GMP_DECLSPEC
void gcd
__GMP_PROTO ((const MINT
*, const MINT
*, MINT
*));
153 __GMP_DECLSPEC
int mcmp
__GMP_PROTO ((const MINT
*, const MINT
*));
154 __GMP_DECLSPEC
void min
__GMP_PROTO ((MINT
*));
155 __GMP_DECLSPEC
void mout
__GMP_PROTO ((const MINT
*));
156 __GMP_DECLSPEC
char *mtox
__GMP_PROTO ((const MINT
*));
157 __GMP_DECLSPEC
void mfree
__GMP_PROTO ((MINT
*));
159 #if defined (__cplusplus)
164 #endif /* __MP_H__ */