1 /* mp.h -- Definitions for Berkeley compatible multiple precision functions.
3 Copyright (C) 1991, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
5 This file is part of the GNU MP Library.
7 The GNU MP Library is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Library General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
12 The GNU MP Library is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15 License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with the GNU MP Library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 MA 02111-1307, USA. */
30 #if defined (__STDC__) || defined (__cplusplus)
31 #define __gmp_const const
36 #if defined (__GNUC__)
37 #define __gmp_inline __inline__
42 #ifndef _EXTERN_INLINE
44 #define _EXTERN_INLINE extern __inline__
46 #define _EXTERN_INLINE static
51 typedef unsigned int mp_limb_t;
52 typedef int mp_limb_signed_t;
54 #ifdef _LONG_LONG_LIMB
55 typedef unsigned long long int mp_limb_t;
56 typedef long long int mp_limb_signed_t;
58 typedef unsigned long int mp_limb_t;
59 typedef long int mp_limb_signed_t;
63 typedef mp_limb_t * mp_ptr;
64 typedef __gmp_const mp_limb_t * mp_srcptr;
65 typedef int mp_size_t;
66 typedef long int mp_exp_t;
71 mp_size_t _mp_alloc; /* Number of *limbs* allocated and pointed
73 mp_size_t _mp_size; /* abs(SIZE) is the number of limbs
74 the last field points to. If SIZE
75 is negative this is a negative
77 mp_limb_t *_mp_d; /* Pointer to the limbs. */
82 short int _mp_alloc; /* Number of *limbs* allocated and pointed
84 short int _mp_size; /* abs(SIZE) is the number of limbs
85 the last field points to. If SIZE
86 is negative this is a negative
88 mp_limb_t *_mp_d; /* Pointer to the limbs. */
91 #endif /* __GNU_MP__ */
93 /* User-visible types. */
94 typedef __mpz_struct MINT;
97 void mp_set_memory_functions (void *(*) (size_t),
98 void *(*) (void *, size_t, size_t),
99 void (*) (void *, size_t));
100 MINT *itom (signed short int);
101 MINT *xtom (const char *);
102 void move (const MINT *, MINT *);
103 void madd (const MINT *, const MINT *, MINT *);
104 void msub (const MINT *, const MINT *, MINT *);
105 void mult (const MINT *, const MINT *, MINT *);
106 void mdiv (const MINT *, const MINT *, MINT *, MINT *);
107 void sdiv (const MINT *, signed short int, MINT *, signed short int *);
108 void msqrt (const MINT *, MINT *, MINT *);
109 void pow (const MINT *, const MINT *, const MINT *, MINT *);
110 void rpow (const MINT *, signed short int, MINT *);
111 void gcd (const MINT *, const MINT *, MINT *);
112 int mcmp (const MINT *, const MINT *);
114 void mout (const MINT *);
115 char *mtox (const MINT *);
120 void mp_set_memory_functions ();
141 #endif /* __MP_H__ */