tizen 2.3 release
[external/gmp.git] / mp-h.in
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, 2004 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., 51 Franklin Street, Fifth Floor, Boston,
22 MA 02110-1301, 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 ! defined (__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__)
73 #define __GMP_DECLSPEC_EXPORT  __declspec(__dllexport__)
74 #define __GMP_DECLSPEC_IMPORT  __declspec(__dllimport__)
75 #endif
76 #if defined (_MSC_VER) || defined (__BORLANDC__)
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
99 #ifdef __GMP_SHORT_LIMB
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 struct
113 {
114   int _mp_alloc;                /* Number of *limbs* allocated and pointed
115                                    to by the _mp_d field.  */
116   int _mp_size;                 /* abs(_mp_size) is the number of limbs the
117                                    last field points to.  If _mp_size is
118                                    negative this is a negative number.  */
119   mp_limb_t *_mp_d;             /* Pointer to the limbs.  */
120 } __mpz_struct;
121
122 #endif /* __GNU_MP__ */
123
124 /* User-visible types.  */
125 typedef __mpz_struct MINT;
126
127
128 #if __GMP_HAVE_PROTOTYPES
129 #define __GMP_PROTO(x) x
130 #else
131 #define __GMP_PROTO(x) ()
132 #endif
133
134 #if defined (__cplusplus)
135 extern "C" {
136 #endif
137
138 #define mp_set_memory_functions __gmp_set_memory_functions
139 __GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t),
140                                       void *(*) (void *, size_t, size_t),
141                                       void (*) (void *, size_t)));
142 __GMP_DECLSPEC MINT *itom __GMP_PROTO ((signed short int));
143 __GMP_DECLSPEC MINT *xtom __GMP_PROTO ((const char *));
144 __GMP_DECLSPEC void move __GMP_PROTO ((const MINT *, MINT *));
145 __GMP_DECLSPEC void madd __GMP_PROTO ((const MINT *, const MINT *, MINT *));
146 __GMP_DECLSPEC void msub __GMP_PROTO ((const MINT *, const MINT *, MINT *));
147 __GMP_DECLSPEC void mult __GMP_PROTO ((const MINT *, const MINT *, MINT *));
148 __GMP_DECLSPEC void mdiv __GMP_PROTO ((const MINT *, const MINT *, MINT *, MINT *));
149 __GMP_DECLSPEC void sdiv __GMP_PROTO ((const MINT *, signed short int, MINT *, signed short int *));
150 __GMP_DECLSPEC void msqrt __GMP_PROTO ((const MINT *, MINT *, MINT *));
151 __GMP_DECLSPEC void pow __GMP_PROTO ((const MINT *, const MINT *, const MINT *, MINT *));
152 __GMP_DECLSPEC void rpow __GMP_PROTO ((const MINT *, signed short int, MINT *));
153 __GMP_DECLSPEC void gcd __GMP_PROTO ((const MINT *, const MINT *, MINT *));
154 __GMP_DECLSPEC int  mcmp __GMP_PROTO ((const MINT *, const MINT *));
155 __GMP_DECLSPEC void min __GMP_PROTO ((MINT *));
156 __GMP_DECLSPEC void mout __GMP_PROTO ((const MINT *));
157 __GMP_DECLSPEC char *mtox __GMP_PROTO ((const MINT *));
158 __GMP_DECLSPEC void mfree __GMP_PROTO ((MINT *));
159
160 #if defined (__cplusplus)
161 }
162 #endif
163
164 #define __MP_H__
165 #endif /* __MP_H__ */