Upload Tizen:Base source
[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 3 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.  If not, see http://www.gnu.org/licenses/.  */
21
22 #ifndef __MP_H__
23
24
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.  */
28 #ifndef __GNU_MP__
29 #define __GNU_MP__ 5
30
31 #define __need_size_t  /* tell gcc stddef.h we only want size_t */
32 #if defined (__cplusplus)
33 #include <cstddef>     /* for size_t */
34 #else
35 #include <stddef.h>    /* for size_t */
36 #endif
37 #undef __need_size_t
38
39 /* The following instantiated by configure, for internal use only */
40 #if ! defined (__GMP_WITHIN_CONFIGURE)
41 @DEFN_LONG_LONG_LIMB@
42 #define __GMP_LIBGMP_DLL  @LIBGMP_DLL@
43 #endif
44
45 #if  defined (__STDC__)                                 \
46   || defined (__cplusplus)                              \
47   || defined (_AIX)                                     \
48   || defined (__DECC)                                   \
49   || (defined (__mips) && defined (_SYSTYPE_SVR4))      \
50   || defined (_MSC_VER)                                 \
51   || defined (_WIN32)
52 #define __GMP_HAVE_CONST        1
53 #define __GMP_HAVE_PROTOTYPES   1
54 #define __GMP_HAVE_TOKEN_PASTE  1
55 #else
56 #define __GMP_HAVE_CONST        0
57 #define __GMP_HAVE_PROTOTYPES   0
58 #define __GMP_HAVE_TOKEN_PASTE  0
59 #endif
60
61
62 #if __GMP_HAVE_CONST
63 #define __gmp_const   const
64 #define __gmp_signed  signed
65 #else
66 #define __gmp_const
67 #define __gmp_signed
68 #endif
69
70 #if defined (__GNUC__)
71 #define __GMP_DECLSPEC_EXPORT  __declspec(__dllexport__)
72 #define __GMP_DECLSPEC_IMPORT  __declspec(__dllimport__)
73 #endif
74 #if defined (_MSC_VER) || defined (__BORLANDC__)
75 #define __GMP_DECLSPEC_EXPORT  __declspec(dllexport)
76 #define __GMP_DECLSPEC_IMPORT  __declspec(dllimport)
77 #endif
78 #ifdef __WATCOMC__
79 #define __GMP_DECLSPEC_EXPORT  __export
80 #define __GMP_DECLSPEC_IMPORT  __import
81 #endif
82 #ifdef __IBMC__
83 #define __GMP_DECLSPEC_EXPORT  _Export
84 #define __GMP_DECLSPEC_IMPORT  _Import
85 #endif
86
87 #if __GMP_LIBGMP_DLL
88 #if __GMP_WITHIN_GMP
89 #define __GMP_DECLSPEC  __GMP_DECLSPEC_EXPORT
90 #else
91 #define __GMP_DECLSPEC  __GMP_DECLSPEC_IMPORT
92 #endif
93 #else
94 #define __GMP_DECLSPEC
95 #endif
96
97 #ifdef __GMP_SHORT_LIMB
98 typedef unsigned int            mp_limb_t;
99 typedef int                     mp_limb_signed_t;
100 #else
101 #ifdef _LONG_LONG_LIMB
102 typedef unsigned long long int  mp_limb_t;
103 typedef long long int           mp_limb_signed_t;
104 #else
105 typedef unsigned long int       mp_limb_t;
106 typedef long int                mp_limb_signed_t;
107 #endif
108 #endif
109 typedef unsigned long int       mp_bitcnt_t;
110
111 typedef struct
112 {
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.  */
119 } __mpz_struct;
120
121 #endif /* __GNU_MP__ */
122
123 /* User-visible types.  */
124 typedef __mpz_struct MINT;
125
126
127 #if __GMP_HAVE_PROTOTYPES
128 #define __GMP_PROTO(x) x
129 #else
130 #define __GMP_PROTO(x) ()
131 #endif
132
133 #if defined (__cplusplus)
134 extern "C" {
135 #endif
136
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 *));
158
159 #if defined (__cplusplus)
160 }
161 #endif
162
163 #define __MP_H__
164 #endif /* __MP_H__ */