[18190] | 1 | /* mp-h.in -- Definitions for the GNU multiple precision library -*-mode:c-*- |
---|
| 2 | BSD mp compatible functions. |
---|
| 3 | |
---|
[22253] | 4 | Copyright 1991, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2004 Free Software |
---|
[18190] | 5 | Foundation, Inc. |
---|
| 6 | |
---|
| 7 | This file is part of the GNU MP Library. |
---|
| 8 | |
---|
| 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 2.1 of the License, or (at your |
---|
| 12 | option) any later version. |
---|
| 13 | |
---|
| 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. |
---|
| 18 | |
---|
| 19 | You should have received a copy of the GNU Lesser General Public License |
---|
| 20 | along with the GNU MP Library; see the file COPYING.LIB. If not, write to |
---|
| 21 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
---|
| 22 | MA 02111-1307, USA. */ |
---|
| 23 | |
---|
| 24 | #ifndef __MP_H__ |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | /* The following (everything under ifndef __GNU_MP__) must be identical in |
---|
| 28 | gmp.h and mp.h to allow both to be included in an application or during |
---|
| 29 | the library build. Use the t-gmp-mp-h.pl script to check. */ |
---|
| 30 | #ifndef __GNU_MP__ |
---|
| 31 | #define __GNU_MP__ 4 |
---|
| 32 | |
---|
| 33 | #define __need_size_t /* tell gcc stddef.h we only want size_t */ |
---|
| 34 | #if defined (__cplusplus) |
---|
| 35 | #include <cstddef> /* for size_t */ |
---|
| 36 | #else |
---|
| 37 | #include <stddef.h> /* for size_t */ |
---|
| 38 | #endif |
---|
| 39 | #undef __need_size_t |
---|
| 40 | |
---|
| 41 | /* The following instantiated by configure, for internal use only */ |
---|
[22253] | 42 | #if ! defined (__GMP_WITHIN_CONFIGURE) |
---|
[18190] | 43 | @DEFN_LONG_LONG_LIMB@ |
---|
| 44 | #define __GMP_LIBGMP_DLL @LIBGMP_DLL@ |
---|
| 45 | #endif |
---|
| 46 | |
---|
| 47 | #if defined (__STDC__) \ |
---|
| 48 | || defined (__cplusplus) \ |
---|
| 49 | || defined (_AIX) \ |
---|
| 50 | || defined (__DECC) \ |
---|
| 51 | || (defined (__mips) && defined (_SYSTYPE_SVR4)) \ |
---|
| 52 | || defined (_MSC_VER) \ |
---|
| 53 | || defined (_WIN32) |
---|
| 54 | #define __GMP_HAVE_CONST 1 |
---|
| 55 | #define __GMP_HAVE_PROTOTYPES 1 |
---|
| 56 | #define __GMP_HAVE_TOKEN_PASTE 1 |
---|
| 57 | #else |
---|
| 58 | #define __GMP_HAVE_CONST 0 |
---|
| 59 | #define __GMP_HAVE_PROTOTYPES 0 |
---|
| 60 | #define __GMP_HAVE_TOKEN_PASTE 0 |
---|
| 61 | #endif |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | #if __GMP_HAVE_CONST |
---|
| 65 | #define __gmp_const const |
---|
| 66 | #define __gmp_signed signed |
---|
| 67 | #else |
---|
| 68 | #define __gmp_const |
---|
| 69 | #define __gmp_signed |
---|
| 70 | #endif |
---|
| 71 | |
---|
[22253] | 72 | #if defined (__GNUC__) |
---|
| 73 | #define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__) |
---|
| 74 | #define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__) |
---|
| 75 | #endif |
---|
| 76 | #if defined (_MSC_VER) || defined (__BORLANDC__) |
---|
[18190] | 77 | #define __GMP_DECLSPEC_EXPORT __declspec(dllexport) |
---|
| 78 | #define __GMP_DECLSPEC_IMPORT __declspec(dllimport) |
---|
| 79 | #endif |
---|
| 80 | #ifdef __WATCOMC__ |
---|
| 81 | #define __GMP_DECLSPEC_EXPORT __export |
---|
| 82 | #define __GMP_DECLSPEC_IMPORT __import |
---|
| 83 | #endif |
---|
| 84 | #ifdef __IBMC__ |
---|
| 85 | #define __GMP_DECLSPEC_EXPORT _Export |
---|
| 86 | #define __GMP_DECLSPEC_IMPORT _Import |
---|
| 87 | #endif |
---|
| 88 | |
---|
| 89 | #if __GMP_LIBGMP_DLL |
---|
| 90 | #if __GMP_WITHIN_GMP |
---|
| 91 | #define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT |
---|
| 92 | #else |
---|
| 93 | #define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT |
---|
| 94 | #endif |
---|
| 95 | #else |
---|
| 96 | #define __GMP_DECLSPEC |
---|
| 97 | #endif |
---|
| 98 | |
---|
[22253] | 99 | #ifdef __GMP_SHORT_LIMB |
---|
[18190] | 100 | typedef unsigned int mp_limb_t; |
---|
| 101 | typedef int mp_limb_signed_t; |
---|
| 102 | #else |
---|
| 103 | #ifdef _LONG_LONG_LIMB |
---|
| 104 | typedef unsigned long long int mp_limb_t; |
---|
| 105 | typedef long long int mp_limb_signed_t; |
---|
| 106 | #else |
---|
| 107 | typedef unsigned long int mp_limb_t; |
---|
| 108 | typedef long int mp_limb_signed_t; |
---|
| 109 | #endif |
---|
| 110 | #endif |
---|
| 111 | |
---|
| 112 | typedef mp_limb_t * mp_ptr; |
---|
| 113 | typedef __gmp_const mp_limb_t * mp_srcptr; |
---|
| 114 | #if defined (_CRAY) && ! defined (_CRAYMPP) |
---|
| 115 | /* plain `int' is much faster (48 bits) */ |
---|
| 116 | #define __GMP_MP_SIZE_T_INT 1 |
---|
| 117 | typedef int mp_size_t; |
---|
| 118 | typedef int mp_exp_t; |
---|
| 119 | #else |
---|
| 120 | #define __GMP_MP_SIZE_T_INT 0 |
---|
| 121 | typedef long int mp_size_t; |
---|
| 122 | typedef long int mp_exp_t; |
---|
| 123 | #endif |
---|
| 124 | |
---|
| 125 | typedef struct |
---|
| 126 | { |
---|
| 127 | int _mp_alloc; /* Number of *limbs* allocated and pointed |
---|
| 128 | to by the _mp_d field. */ |
---|
| 129 | int _mp_size; /* abs(_mp_size) is the number of limbs the |
---|
| 130 | last field points to. If _mp_size is |
---|
| 131 | negative this is a negative number. */ |
---|
| 132 | mp_limb_t *_mp_d; /* Pointer to the limbs. */ |
---|
| 133 | } __mpz_struct; |
---|
| 134 | |
---|
| 135 | #endif /* __GNU_MP__ */ |
---|
| 136 | |
---|
| 137 | /* User-visible types. */ |
---|
| 138 | typedef __mpz_struct MINT; |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | #if __GMP_HAVE_PROTOTYPES |
---|
| 142 | #define __GMP_PROTO(x) x |
---|
| 143 | #else |
---|
| 144 | #define __GMP_PROTO(x) () |
---|
| 145 | #endif |
---|
| 146 | |
---|
| 147 | #if defined (__cplusplus) |
---|
| 148 | extern "C" { |
---|
| 149 | #endif |
---|
| 150 | |
---|
| 151 | #define mp_set_memory_functions __gmp_set_memory_functions |
---|
| 152 | __GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t), |
---|
| 153 | void *(*) (void *, size_t, size_t), |
---|
| 154 | void (*) (void *, size_t))); |
---|
| 155 | __GMP_DECLSPEC MINT *itom __GMP_PROTO ((signed short int)); |
---|
| 156 | __GMP_DECLSPEC MINT *xtom __GMP_PROTO ((const char *)); |
---|
| 157 | __GMP_DECLSPEC void move __GMP_PROTO ((const MINT *, MINT *)); |
---|
| 158 | __GMP_DECLSPEC void madd __GMP_PROTO ((const MINT *, const MINT *, MINT *)); |
---|
| 159 | __GMP_DECLSPEC void msub __GMP_PROTO ((const MINT *, const MINT *, MINT *)); |
---|
| 160 | __GMP_DECLSPEC void mult __GMP_PROTO ((const MINT *, const MINT *, MINT *)); |
---|
| 161 | __GMP_DECLSPEC void mdiv __GMP_PROTO ((const MINT *, const MINT *, MINT *, MINT *)); |
---|
| 162 | __GMP_DECLSPEC void sdiv __GMP_PROTO ((const MINT *, signed short int, MINT *, signed short int *)); |
---|
| 163 | __GMP_DECLSPEC void msqrt __GMP_PROTO ((const MINT *, MINT *, MINT *)); |
---|
| 164 | __GMP_DECLSPEC void pow __GMP_PROTO ((const MINT *, const MINT *, const MINT *, MINT *)); |
---|
| 165 | __GMP_DECLSPEC void rpow __GMP_PROTO ((const MINT *, signed short int, MINT *)); |
---|
| 166 | __GMP_DECLSPEC void gcd __GMP_PROTO ((const MINT *, const MINT *, MINT *)); |
---|
| 167 | __GMP_DECLSPEC int mcmp __GMP_PROTO ((const MINT *, const MINT *)); |
---|
| 168 | __GMP_DECLSPEC void min __GMP_PROTO ((MINT *)); |
---|
| 169 | __GMP_DECLSPEC void mout __GMP_PROTO ((const MINT *)); |
---|
| 170 | __GMP_DECLSPEC char *mtox __GMP_PROTO ((const MINT *)); |
---|
| 171 | __GMP_DECLSPEC void mfree __GMP_PROTO ((MINT *)); |
---|
| 172 | |
---|
| 173 | #if defined (__cplusplus) |
---|
| 174 | } |
---|
| 175 | #endif |
---|
| 176 | |
---|
| 177 | #define __MP_H__ |
---|
| 178 | #endif /* __MP_H__ */ |
---|