[project @ 1998-11-26 09:17:22 by sof]
[ghc-hetmet.git] / ghc / runtime / gmp / mp.h
1 /* mp.h -- Definitions for Berkeley compatible multiple precision functions.
2
3 Copyright (C) 1991, 1993 Free Software Foundation, Inc.
4
5 This file is part of the GNU MP Library.
6
7 The GNU MP Library is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 The GNU MP Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with the GNU MP Library; see the file COPYING.  If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
20
21 #ifndef __MP_H__
22 #define __MP_H__
23
24 #define __GNU_MP__
25
26 #ifndef __GMP_H__
27 #define __need_size_t
28 #include <stddef.h>
29 #endif
30
31 #ifndef MP_INT
32 #ifndef __MP_SMALL__
33 typedef struct
34 {
35   long int alloc;               /* Number of *limbs* allocated and pointed
36                                    to by the D field.  */
37   long int size;                /* abs(SIZE) is the number of limbs
38                                    the last field points to.  If SIZE
39                                    is negative this is a negative
40                                    number.  */
41   unsigned long int *d;         /* Pointer to the limbs.  */
42 } __MP_INT;
43 #else
44 typedef struct
45 {
46   short int alloc;              /* Number of *limbs* allocated and pointed
47                                    to by the D field.  */
48   short int size;               /* abs(SIZE) is the number of limbs
49                                    the last field points to.  If SIZE
50                                    is negative this is a negative
51                                    number.  */
52   unsigned long int *d;         /* Pointer to the limbs.  */
53 } __MP_INT;
54 #endif
55 #endif
56
57 #define MINT __MP_INT
58
59 #ifdef __STDC__
60 void mp_set_memory_functions (void *(*) (size_t),
61                               void *(*) (void *, size_t, size_t),
62                               void (*) (void *, size_t));
63 MINT *itom (signed short int);
64 MINT *xtom (const char *);
65 void move (const MINT *, MINT *);
66 void madd (const MINT *, const MINT *, MINT *);
67 void msub (const MINT *, const MINT *, MINT *);
68 void mult (const MINT *, const MINT *, MINT *);
69 void mdiv (const MINT *, const MINT *, MINT *, MINT *);
70 void sdiv (const MINT *, signed short int, MINT *, signed short int *);
71 void msqrt (const MINT *, MINT *, MINT *);
72 void pow (const MINT *, const MINT *, const MINT *, MINT *);
73 void rpow (const MINT *, signed short int, MINT *);
74 void gcd (const MINT *, const MINT *, MINT *);
75 int mcmp (const MINT *, const MINT *);
76 void min (MINT *);
77 void mout (const MINT *);
78 char *mtox (const MINT *);
79 void mfree (MINT *);
80
81 #else
82
83 void mp_set_memory_functions ();
84 MINT *itom ();
85 MINT *xtom ();
86 void move ();
87 void madd ();
88 void msub ();
89 void mult ();
90 void mdiv ();
91 void sdiv ();
92 void msqrt ();
93 void pow ();
94 void rpow ();
95 void gcd ();
96 int mcmp ();
97 void min ();
98 void mout ();
99 char *mtox ();
100 void mfree ();
101 #endif
102
103 #endif /* __MP_H__ */