[18190] | 1 | /* mp-h.in -- Definitions for the GNU multiple precision library -*-mode:c-*- |
---|
| 2 | BSD mp compatible functions. |
---|
| 3 | |
---|
| 4 | Copyright 1991, 1993, 1994, 1995, 1996, 2000, 2001, 2002 Free Software |
---|
| 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 */ |
---|
| 42 | #if ! __GMP_WITHIN_CONFIGURE |
---|
| 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 | |
---|
| 72 | #if defined (__GNUC__) || defined (_MSC_VER) || defined (__BORLANDC__) |
---|
| 73 | #define __GMP_DECLSPEC_EXPORT __declspec(dllexport) |
---|
| 74 | #define __GMP_DECLSPEC_IMPORT __declspec(dllimport) |
---|
| 75 | #endif |
---|
| 76 | #ifdef __WATCOMC__ |
---|
| 77 | #define __GMP_DECLSPEC_EXPORT __export |
---|
| 78 | #define __GMP_DECLSPEC_IMPORT __import |
---|
| 79 | #endif |
---|
| 80 | #ifdef __IBMC__ |
---|
| 81 | #define __GMP_DECLSPEC_EXPORT _Export |
---|
| 82 | #define __GMP_DECLSPEC_IMPORT _Import |
---|
| 83 | #endif |
---|
| 84 | |
---|
| 85 | #if __GMP_LIBGMP_DLL |
---|
| 86 | #if __GMP_WITHIN_GMP |
---|
| 87 | #define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT |
---|
| 88 | #else |
---|
| 89 | #define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT |
---|
| 90 | #endif |
---|
| 91 | #else |
---|
| 92 | #define __GMP_DECLSPEC |
---|
| 93 | #endif |
---|
| 94 | |
---|
| 95 | #ifdef _SHORT_LIMB |
---|
| 96 | typedef unsigned int mp_limb_t; |
---|
| 97 | typedef int mp_limb_signed_t; |
---|
| 98 | #else |
---|
| 99 | #ifdef _LONG_LONG_LIMB |
---|
| 100 | typedef unsigned long long int mp_limb_t; |
---|
| 101 | typedef long long int mp_limb_signed_t; |
---|
| 102 | #else |
---|
| 103 | typedef unsigned long int mp_limb_t; |
---|
| 104 | typedef long int mp_limb_signed_t; |
---|
| 105 | #endif |
---|
| 106 | #endif |
---|
| 107 | |
---|
| 108 | typedef mp_limb_t * mp_ptr; |
---|
| 109 | typedef __gmp_const mp_limb_t * mp_srcptr; |
---|
| 110 | #if defined (_CRAY) && ! defined (_CRAYMPP) |
---|
| 111 | /* plain `int' is much faster (48 bits) */ |
---|
| 112 | #define __GMP_MP_SIZE_T_INT 1 |
---|
| 113 | typedef int mp_size_t; |
---|
| 114 | typedef int mp_exp_t; |
---|
| 115 | #else |
---|
| 116 | #define __GMP_MP_SIZE_T_INT 0 |
---|
| 117 | typedef long int mp_size_t; |
---|
| 118 | typedef long int mp_exp_t; |
---|
| 119 | #endif |
---|
| 120 | |
---|
| 121 | typedef struct |
---|
| 122 | { |
---|
| 123 | int _mp_alloc; /* Number of *limbs* allocated and pointed |
---|
| 124 | to by the _mp_d field. */ |
---|
| 125 | int _mp_size; /* abs(_mp_size) is the number of limbs the |
---|
| 126 | last field points to. If _mp_size is |
---|
| 127 | negative this is a negative number. */ |
---|
| 128 | mp_limb_t *_mp_d; /* Pointer to the limbs. */ |
---|
| 129 | } __mpz_struct; |
---|
| 130 | |
---|
| 131 | #endif /* __GNU_MP__ */ |
---|
| 132 | |
---|
| 133 | /* User-visible types. */ |
---|
| 134 | typedef __mpz_struct MINT; |
---|
| 135 | |
---|
| 136 | |
---|
| 137 | #if __GMP_HAVE_PROTOTYPES |
---|
| 138 | #define __GMP_PROTO(x) x |
---|
| 139 | #else |
---|
| 140 | #define __GMP_PROTO(x) () |
---|
| 141 | #endif |
---|
| 142 | |
---|
| 143 | #if defined (__cplusplus) |
---|
| 144 | extern "C" { |
---|
| 145 | #endif |
---|
| 146 | |
---|
| 147 | #define mp_set_memory_functions __gmp_set_memory_functions |
---|
| 148 | __GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t), |
---|
| 149 | void *(*) (void *, size_t, size_t), |
---|
| 150 | void (*) (void *, size_t))); |
---|
| 151 | __GMP_DECLSPEC MINT *itom __GMP_PROTO ((signed short int)); |
---|
| 152 | __GMP_DECLSPEC MINT *xtom __GMP_PROTO ((const char *)); |
---|
| 153 | __GMP_DECLSPEC void move __GMP_PROTO ((const MINT *, MINT *)); |
---|
| 154 | __GMP_DECLSPEC void madd __GMP_PROTO ((const MINT *, const MINT *, MINT *)); |
---|
| 155 | __GMP_DECLSPEC void msub __GMP_PROTO ((const MINT *, const MINT *, MINT *)); |
---|
| 156 | __GMP_DECLSPEC void mult __GMP_PROTO ((const MINT *, const MINT *, MINT *)); |
---|
| 157 | __GMP_DECLSPEC void mdiv __GMP_PROTO ((const MINT *, const MINT *, MINT *, MINT *)); |
---|
| 158 | __GMP_DECLSPEC void sdiv __GMP_PROTO ((const MINT *, signed short int, MINT *, signed short int *)); |
---|
| 159 | __GMP_DECLSPEC void msqrt __GMP_PROTO ((const MINT *, MINT *, MINT *)); |
---|
| 160 | __GMP_DECLSPEC void pow __GMP_PROTO ((const MINT *, const MINT *, const MINT *, MINT *)); |
---|
| 161 | __GMP_DECLSPEC void rpow __GMP_PROTO ((const MINT *, signed short int, MINT *)); |
---|
| 162 | __GMP_DECLSPEC void gcd __GMP_PROTO ((const MINT *, const MINT *, MINT *)); |
---|
| 163 | __GMP_DECLSPEC int mcmp __GMP_PROTO ((const MINT *, const MINT *)); |
---|
| 164 | __GMP_DECLSPEC void min __GMP_PROTO ((MINT *)); |
---|
| 165 | __GMP_DECLSPEC void mout __GMP_PROTO ((const MINT *)); |
---|
| 166 | __GMP_DECLSPEC char *mtox __GMP_PROTO ((const MINT *)); |
---|
| 167 | __GMP_DECLSPEC void mfree __GMP_PROTO ((MINT *)); |
---|
| 168 | |
---|
| 169 | #if defined (__cplusplus) |
---|
| 170 | } |
---|
| 171 | #endif |
---|
| 172 | |
---|
| 173 | #define __MP_H__ |
---|
| 174 | #endif /* __MP_H__ */ |
---|