forked from passagemath/LiDIA
-
Notifications
You must be signed in to change notification settings - Fork 1
/
LiDIA.h.in
216 lines (146 loc) · 4.1 KB
/
LiDIA.h.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// -*- C++ -*-
//==============================================================================================
//
// This file is part of LiDIA --- a library for computational number theory
//
// Copyright (c) 1994--2001 the LiDIA Group. All rights reserved.
//
// See http://www.informatik.tu-darmstadt.de/TI/LiDIA/
//
//----------------------------------------------------------------------------------------------
//
// $Id$
//
// Author : Thomas Papanikolaou, Safuat Hamdy
// Changes : See CVS log
//
//==============================================================================================
#ifndef LIDIA_LIDIA_H_GUARD_
#define LIDIA_LIDIA_H_GUARD_
#undef LIDIA_MAJOR_VERSION
#undef LIDIA_MINOR_VERSION
#undef LIDIA_PATCH_VERSION
// <cstddef> canonically defines NULL and size_t
#include <cstddef>
#include <cstdlib>
#include <climits>
#define C_STDIO
// <iostream> is used almost everywhere
#include <iostream>
#ifdef C_STDIO
# include <cstdio>
#endif
#define LIDIA_ARITH_GMP 0x100
#define LIDIA_ARITH_CLN 0x101
#define LIDIA_ARITH_LIBI 0x102
#define LIDIA_ARITH_PIOLOGIE 0x103
//#define LIDIA_ARITH_FREELIP 0x104
//#define LIDIA_ARITH_OPENSSL 0x105
//
// set LIDIA_ARITHMETIC to one of the above values
//
#undef LIDIA_ARITHMETIC
// safety belt
#if !defined LIDIA_ARITHMETIC || LIDIA_ARITHMETIC == 0
# error LiDIA arithmetic not defined or improperly set!
#endif
//
// Set to 1 if the arithmetic interface inlines the underlying arithmetic routines.
//
#undef INLINE_INTERFACE
//
// some compiler characteristics (at configuration time)
//
// The number of bytes in a short.
#undef SIZEOF_SHORT
// The number of bytes in a int.
#undef SIZEOF_INT
// The number of bytes in a long.
#undef SIZEOF_LONG
// The number of bytes in a double.
#undef SIZEOF_DOUBLE
// Define, if words are big endian.
#undef WORDS_BIGENDIAN
// Define if <strstream> shall be used instead of <sstream>
#undef OSSTREAM_USE_STRSTREAM
#if defined(__hpux) && !defined(__GNUC__)
# define HAVE_HP_UX_CC
# define LIDIA_NO_SF_BIGINT
#endif
// Define if you want error handling via exceptions
#undef LIDIA_EXCEPTIONS
// Define if you want namespaces.
#undef LIDIA_NAMESPACE
// if name spaces are not wanted, define LiDIA to be <empty>
#ifndef LIDIA_NAMESPACE
# define LiDIA
#endif
#ifdef LIDIA_NAMESPACE
namespace LiDIA {
#endif
enum {
BITS_PER_CHAR = CHAR_BIT,
HIGH_BIT_UCHAR = (1UL << (BITS_PER_CHAR - 1)),
BITS_PER_SHORT = BITS_PER_CHAR * SIZEOF_SHORT,
HIGH_BIT_USHORT = (1UL << (BITS_PER_SHORT - 1)),
BITS_PER_INT = BITS_PER_CHAR * SIZEOF_INT,
HIGH_BIT_UINT = (1UL << (BITS_PER_INT - 1)),
BITS_PER_LONG = BITS_PER_CHAR * SIZEOF_LONG,
HIGH_BIT_ULONG = (1UL << (BITS_PER_LONG - 1)),
BITS_PER_DOUBLE = BITS_PER_CHAR * SIZEOF_DOUBLE
};
//
// these are the types for machine integers
// define sizetify to longify if lidia_size_t == long
//
typedef int lidia_size_t;
#define sizetify intify
typedef long sdigit;
// typedef unsigned long udigit;
#ifdef LIDIA_NAMESPACE
} // end of namespace LiDIA
#endif
//
// Debug handling for templates
//
#ifndef LIDIA_DEBUG_LIMIT
# define LIDIA_DEBUG_LIMIT -1000
#endif
#define LDBL_VECTOR (LIDIA_DEBUG_LIMIT + 0)
#define LDBL_UNIPOL (LIDIA_DEBUG_LIMIT + 50)
#define LDBL_UNIPOW (LIDIA_DEBUG_LIMIT + 100)
#define LDBL_MATRIX (LIDIA_DEBUG_LIMIT + 150)
//
// include LiDIA system files
//
#include <LiDIA/warning.h>
#include <LiDIA/error.h>
#include <LiDIA/debug.h>
#include <LiDIA/memory.h>
//
// The maximal number of characters of which the
// operating system is able to put in one line.
//
#ifndef LIDIA_CHARS_PER_LINE
# define LIDIA_CHARS_PER_LINE 0
#endif
//
// LiDIA macros
//
#ifndef LIDIA_MACROS
# define LIDIA_MACROS
#endif
#define lidia_rint(x) (floor((x)+0.5))
#if (defined(__hpux) && !defined(__STDC__))
# define __STDC__
#endif
#if defined(__STDC__) || defined (_MSC_VER)
# define LIDIA_CONCAT2(a,b) a##b
# define LIDIA_CONCAT3(a,b,c) a##b##c
# define LIDIA_CONCAT4(a,b,c,d) a##b##c##d
#else
# define LIDIA_CONCAT2(a,b) a/**/b
# define LIDIA_CONCAT3(a,b,c) a/**/b/**/c
# define LIDIA_CONCAT4(a,b,c,d) a/**/b/**/c/**/d
#endif
#endif // LIDIA_LIDIA_H_GUARD_