1 | |
---|
2 | #ifndef NTL_config__H |
---|
3 | #define NTL_config__H |
---|
4 | |
---|
5 | /************************************************************************* |
---|
6 | |
---|
7 | NTL Configuration File |
---|
8 | ---------------------- |
---|
9 | |
---|
10 | This file may be modified prior to building NTL so as to specify |
---|
11 | some basic configuration options, and to customize |
---|
12 | how code is generated so as to improve performance. |
---|
13 | |
---|
14 | The Basic Configuration Options must be set by hand. If you use the |
---|
15 | configuration wizard, then these flags should be set before |
---|
16 | the installation process begins; there values will be retained |
---|
17 | by the wizard. |
---|
18 | |
---|
19 | The Performance Options can be set either by hand, by editing this |
---|
20 | file, or (on most Unix platforms) can be set automatically using |
---|
21 | the configuration wizard which runs when NTL is installed. |
---|
22 | |
---|
23 | All NTL include (".h") files include this file. |
---|
24 | By setting these flags here, instead of on the compiler command line, |
---|
25 | it is easier to guarantee that NTL library and client code use |
---|
26 | consistent settings. |
---|
27 | |
---|
28 | |
---|
29 | How to do it |
---|
30 | ------------ |
---|
31 | |
---|
32 | You override NTL's default code generation strategies by setting |
---|
33 | various flags, as described below. To set a flag, just replace the |
---|
34 | pre-processor directive 'if 0' by 'if 1' for that flag, |
---|
35 | which causes the appropriate macro to be defined. Of course, |
---|
36 | to unset a flag, just replace the 'if 1' by an 'if 0'. |
---|
37 | |
---|
38 | *************************************************************************/ |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | /************************************************************************* |
---|
43 | * |
---|
44 | * Basic Configuration Options |
---|
45 | * |
---|
46 | *************************************************************************/ |
---|
47 | |
---|
48 | |
---|
49 | /* None of these flags are set by the configuration wizard; |
---|
50 | * they must be set by hand, before installation begins. |
---|
51 | */ |
---|
52 | |
---|
53 | #if <NTL_STD_CXX> |
---|
54 | #define NTL_STD_CXX |
---|
55 | |
---|
56 | /* |
---|
57 | * Use this flag if you want to use the "Standard C++" version of NTL. |
---|
58 | * In this version, all of NTL is "wrapped" inside the namespace NTL, |
---|
59 | * and are no longer directly accessible---you must either use |
---|
60 | * explicit qualification, or using directives, or using declarations. |
---|
61 | * However, note that all names that begin with "NTL_" are macros, |
---|
62 | * and as such do not belong to any namespace. |
---|
63 | * Additionally, instead of including the standard headers |
---|
64 | * <stdlib.h>, <math.h>, and <iostream.h>, the standard headers |
---|
65 | * <cstdlib>, <cmath>, and <iostream> are included. |
---|
66 | * These "wrap" some (but not all) names in namespace std. |
---|
67 | * Also, the 'nothrow' version on the 'new' operator is used. |
---|
68 | * |
---|
69 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
70 | */ |
---|
71 | |
---|
72 | #endif |
---|
73 | |
---|
74 | /* The following three flags may be used if you want to use some |
---|
75 | * of the features of Standard C++, but your compiler is deficient. |
---|
76 | * Instead of setting the NTL_STD_CXX, you can set any subset |
---|
77 | * of the these three. Setting all three of these flags is equivalent |
---|
78 | * to setting NTL_STD_CXX. No harm is done if NTL_STD_CXX is set |
---|
79 | * and some of the following three flags are set. |
---|
80 | * |
---|
81 | * To re-build after changing any of these flags: rm *.o; make ntl.a |
---|
82 | */ |
---|
83 | |
---|
84 | #if <NTL_PSTD_NNS> |
---|
85 | #define NTL_PSTD_NNS |
---|
86 | |
---|
87 | /* Set if NTL library components are to be wrapped in namespace 'NTL'. */ |
---|
88 | |
---|
89 | #endif |
---|
90 | |
---|
91 | #if <NTL_PSTD_NHF> |
---|
92 | #define NTL_PSTD_NHF |
---|
93 | |
---|
94 | /* Set if you want to use the new header files <cstdlib>, <cmath>, and |
---|
95 | * <iostream>, instead of the traditional header files <stdlib.h>, |
---|
96 | * <math.h>, and <iostream.h>. |
---|
97 | * If new header files are used, then it is assumed that all standard |
---|
98 | * library components are wrapped in namespace std; otherwise, |
---|
99 | * it is assumed that all standard library components are in the |
---|
100 | * global namespace. |
---|
101 | * |
---|
102 | * Also, when set, some internal NTL files use the header <fstream> |
---|
103 | * in place of <fstream.h>. |
---|
104 | */ |
---|
105 | |
---|
106 | #endif |
---|
107 | |
---|
108 | #if <NTL_PSTD_NTN> |
---|
109 | #define NTL_PSTD_NTN |
---|
110 | |
---|
111 | /* Set if you want to use the 'nothrow' version of new. */ |
---|
112 | |
---|
113 | #endif |
---|
114 | |
---|
115 | |
---|
116 | #if <NTL_GMP_LIP> |
---|
117 | #define NTL_GMP_LIP |
---|
118 | |
---|
119 | /* |
---|
120 | * Use this flag if you want to use GMP as the long integer package. |
---|
121 | * This can result in significantly faster code on some platforms. |
---|
122 | * It requires that the GMP package (version >= 3.1) has already been |
---|
123 | * installed. You will also have to set the variables GMP_INCDIR, |
---|
124 | * GMP_LIBDIR, and GMP_LIB in the makefile (these are set automatically |
---|
125 | * by the confiuration script when you pass the flag NTL_GMP_LIP=on |
---|
126 | * to that script. |
---|
127 | * |
---|
128 | * Beware that setting this flag can break some older NTL codes. |
---|
129 | * If you want complete backward compatability, but not quite |
---|
130 | * the full performance of GMP, use the flag NTL_GMP_HACK below. |
---|
131 | * See the full NTL documentation for more details. |
---|
132 | * |
---|
133 | * To re-build after changing this flag: |
---|
134 | * rm *.o; make setup3; make ntl.a |
---|
135 | * You may also have to edit the makefile to modify the variables |
---|
136 | * GMP_INCDIR, GMP_LIBDIR, and GMP_LIB. |
---|
137 | */ |
---|
138 | |
---|
139 | #elif <NTL_GMP_HACK> |
---|
140 | #define NTL_GMP_HACK |
---|
141 | |
---|
142 | /* |
---|
143 | * Use this flag if you want to use GMP as the long integer package. |
---|
144 | * This can result in significantly faster code on some platforms. |
---|
145 | * It requires that the GMP package (version >= 2.0.2) has already been |
---|
146 | * installed. You will also have to set the variables GMP_INCDIR, |
---|
147 | * GMP_LIBDIR, and GMP_LIB in the makefile (these are set automatically |
---|
148 | * by the confiuration script when you pass the flag NTL_GMP_HACK=on |
---|
149 | * to that script. |
---|
150 | * |
---|
151 | * Unlike the NTL_GMP_LIP flag above, setting this flag maintains |
---|
152 | * complete backward compatability with older NTL codes, but |
---|
153 | * you do not get the full performance of GMP. |
---|
154 | * |
---|
155 | * To re-build after changing this flag: |
---|
156 | * rm lip.o; make setup3; make ntl.a |
---|
157 | * You may also have to edit the makefile to modify the variables |
---|
158 | * GMP_INCDIR, GMP_LIBDIR, and GMP_LIB. |
---|
159 | * |
---|
160 | */ |
---|
161 | |
---|
162 | #endif |
---|
163 | |
---|
164 | |
---|
165 | #if <NTL_LONG_LONG_TYPE> |
---|
166 | #define NTL_LONG_LONG_TYPE <VAL_NTL_LONG_LONG_TYPE> |
---|
167 | |
---|
168 | /* |
---|
169 | * If you set NTL_LONG_LONG, you may need to override the default |
---|
170 | * name of this "nonstandard" type. For example, under MS C++, |
---|
171 | * the right name is __int64. |
---|
172 | * |
---|
173 | * This flag is irrelevant when NTL_GMP_LIP is set. |
---|
174 | * |
---|
175 | * To re-build after changing this flag: rm lip.o; make ntl.a |
---|
176 | */ |
---|
177 | |
---|
178 | #endif |
---|
179 | |
---|
180 | |
---|
181 | #if <NTL_CXX_ONLY> |
---|
182 | #define NTL_CXX_ONLY |
---|
183 | |
---|
184 | /* |
---|
185 | * It is possible to compile everything using C++ only. |
---|
186 | * If you want to do this, make CC and CXX in the makefile the same. |
---|
187 | * You may also want to set this flag, which eliminates some |
---|
188 | * "C" linkage that is no longer necessary. |
---|
189 | * However, it should still work without it. |
---|
190 | * |
---|
191 | * This flag can be set independently of NTL_STD_CXX. |
---|
192 | * All functions that may have "C" linkage are never wrapped in |
---|
193 | * namespace NTL; instead, their names always start with "_ntl_", |
---|
194 | * and as such, they should not conflict with other global names. |
---|
195 | * All such names are undocumented, and should never be used |
---|
196 | * by NTL clients under normal circumstances. |
---|
197 | * |
---|
198 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
199 | */ |
---|
200 | |
---|
201 | #endif |
---|
202 | |
---|
203 | |
---|
204 | #if <NTL_RANGE_CHECK> |
---|
205 | #define NTL_RANGE_CHECK |
---|
206 | |
---|
207 | /* |
---|
208 | * This will generate vector subscript range-check code. |
---|
209 | * Useful for debugging, but it slows things down of course. |
---|
210 | * |
---|
211 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
212 | */ |
---|
213 | |
---|
214 | #endif |
---|
215 | |
---|
216 | |
---|
217 | |
---|
218 | |
---|
219 | |
---|
220 | #if <NTL_NO_INIT_TRANS> |
---|
221 | #define NTL_NO_INIT_TRANS |
---|
222 | |
---|
223 | /* |
---|
224 | * Without this flag, NTL uses a special code sequence to avoid |
---|
225 | * copying large objects in return statements. However, if your |
---|
226 | * compiler optimizes away the return of a *named* local object, |
---|
227 | * this is not necessary, and setting this flag will result |
---|
228 | * in *slightly* more compact and efficient code. Although |
---|
229 | * the emeriging C++ standard allows compilers to perform |
---|
230 | * this optimization, I know of none that currently do. |
---|
231 | * Most will avoid copying *temporary* objects in return statements, |
---|
232 | * and NTL's default code sequence exploits this fact. |
---|
233 | * |
---|
234 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
235 | */ |
---|
236 | |
---|
237 | #endif |
---|
238 | |
---|
239 | |
---|
240 | #if <NTL_X86_FIX> |
---|
241 | #define NTL_X86_FIX |
---|
242 | |
---|
243 | /* |
---|
244 | * Forces the "x86 floating point fix", overriding the default behavior. |
---|
245 | * By default, NTL will apply the "fix" if it looks like it is |
---|
246 | * necessary, and if knows how to fix it. |
---|
247 | * The problem addressed here is that x86 processors sometimes |
---|
248 | * run in a mode where FP registers have more precision than doubles. |
---|
249 | * This will cause code in quad_float.c some trouble. |
---|
250 | * NTL can normally correctly detect the problem, and fix it, |
---|
251 | * so you shouldn't need to worry about this or the next flag. |
---|
252 | |
---|
253 | * To re-build after changing this flag: rm quad_float.o; make ntl.a |
---|
254 | * |
---|
255 | */ |
---|
256 | |
---|
257 | #elif <NTL_NO_X86_FIX> |
---|
258 | #define NTL_NO_X86_FIX |
---|
259 | /* |
---|
260 | * Forces no "x86 floating point fix", overriding the default behavior. |
---|
261 | |
---|
262 | * To re-build after changing this flag: rm quad_float.o; make ntl.a |
---|
263 | */ |
---|
264 | |
---|
265 | #endif |
---|
266 | |
---|
267 | |
---|
268 | |
---|
269 | |
---|
270 | /************************************************************************* |
---|
271 | * |
---|
272 | * Performance Options |
---|
273 | * |
---|
274 | *************************************************************************/ |
---|
275 | |
---|
276 | |
---|
277 | /* One can choose one of four different stragtegies for long integer |
---|
278 | * arithmetic: the default, NTL_LONG_LONG, NTL_AVOID_FLOAT, or NTL_SINGLE_MUL. |
---|
279 | * The configuration wizard will choose among the first three; the use of |
---|
280 | * NTL_SINGLE_MUL is not generally recommended. |
---|
281 | * |
---|
282 | * These flags are irrelevant when NTL_GMP_LIP is set, and are simply ignored, |
---|
283 | * except for NTL_SINGLE_MUL -- setting that causes a complie-time error. |
---|
284 | * |
---|
285 | */ |
---|
286 | |
---|
287 | #if <NTL_LONG_LONG> |
---|
288 | #define NTL_LONG_LONG |
---|
289 | |
---|
290 | /* |
---|
291 | * RECOMMENDED FOR some x86 PLATFORMS |
---|
292 | * |
---|
293 | * For platforms that support it, this flag can be set to cause |
---|
294 | * the low-level multiplication code to use the type "long long", |
---|
295 | * which on some platforms yields a significant performance gain, |
---|
296 | * but on others, it can yield no improvement and can even |
---|
297 | * slow things down. |
---|
298 | * |
---|
299 | * The only platform where I know this helps is Linux/Pentium, |
---|
300 | * but even here, the gcc compiler is less than impressive with |
---|
301 | * it code generation. |
---|
302 | * |
---|
303 | * See below (NTL_LONG_LONG_TYPE) for how to use a type name |
---|
304 | * other than "long long". |
---|
305 | * |
---|
306 | * If you set NTL_LONG_LONG, you might also want to set |
---|
307 | * the flag NTL_TBL_REM (see below). |
---|
308 | * |
---|
309 | * To re-build after changing this flag: rm lip.o; make ntl.a |
---|
310 | */ |
---|
311 | |
---|
312 | #elif <NTL_AVOID_FLOAT> |
---|
313 | #define NTL_AVOID_FLOAT |
---|
314 | |
---|
315 | /* |
---|
316 | * RECOMMENDED FOR AIX/PowerPC and some x86 PLATFORMS |
---|
317 | * |
---|
318 | * On machines with slow floating point or---more comminly---slow int/float |
---|
319 | * conversions, this flag can lead to faster code. |
---|
320 | * |
---|
321 | * I get much better code on the AIX/PowerPC platform than with the |
---|
322 | * default setting or with NTL_LONG_LONG flag. |
---|
323 | * |
---|
324 | * I also get slightly better code on the Linux/Pentium-II platform |
---|
325 | * with this flag than with the NTL_LONG_LONG flag; |
---|
326 | * however, on a Pentium-I, NTL_LONG_LONG is much better. |
---|
327 | * |
---|
328 | * If you set NTL_AVOID_FLOAT, you should probably also |
---|
329 | * set NTL_TBL_REM (see below). |
---|
330 | * |
---|
331 | * To re-build after changing this flag: rm lip.o; make ntl.a |
---|
332 | */ |
---|
333 | |
---|
334 | #elif 0 |
---|
335 | #define NTL_SINGLE_MUL |
---|
336 | |
---|
337 | /* This was developed originally to improve performance on |
---|
338 | * ancient Sparc stations that did not have built-in integer mul |
---|
339 | * instructions. Unless you have such an old-timer, I would not |
---|
340 | * recommend using this option. This option only works on |
---|
341 | * 32-bit machines with IEEE floating point, and is not truly |
---|
342 | * portable. If you use this option, you get a 26-bit radix. |
---|
343 | * |
---|
344 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
345 | */ |
---|
346 | |
---|
347 | #endif |
---|
348 | |
---|
349 | |
---|
350 | |
---|
351 | /* The next three flags, NTL_TBL_REM, NTL_AVOID_BRANCHING, NTL_FFT_PIPELINE, |
---|
352 | * are also set by the configuration wizard. |
---|
353 | */ |
---|
354 | |
---|
355 | |
---|
356 | |
---|
357 | #if <NTL_TBL_REM> |
---|
358 | #define NTL_TBL_REM |
---|
359 | |
---|
360 | /* |
---|
361 | * RECOMMENDED FOR AIX/PowerPC and some x86 PLATFORMS |
---|
362 | * |
---|
363 | * With this flag, some divisions are avoided in the |
---|
364 | * ZZ_pX multiplication routines. If you use the NTL_AVOID_FLOAT |
---|
365 | * or NTL_LONG_LONG flags, then you should probably use this one too. |
---|
366 | * |
---|
367 | * Irrelevent when NTL_GMP_LIP is set. |
---|
368 | * |
---|
369 | * To re-build after changing this flag: |
---|
370 | * rm lip.o; make ntl.a |
---|
371 | */ |
---|
372 | |
---|
373 | #endif |
---|
374 | |
---|
375 | |
---|
376 | #if <NTL_AVOID_BRANCHING> |
---|
377 | #define NTL_AVOID_BRANCHING |
---|
378 | |
---|
379 | /* |
---|
380 | * With this option, branches are replaced at several |
---|
381 | * key points with equivalent code using shifts and masks. |
---|
382 | * Recommended for use with RISC architectures, especially |
---|
383 | * ones with deep pipelines and high branch penalities. |
---|
384 | * This flag is becoming less helpful as newer machines |
---|
385 | * have much smaller branch penalties, but still may be worth a try. |
---|
386 | * |
---|
387 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
388 | */ |
---|
389 | |
---|
390 | #endif |
---|
391 | |
---|
392 | |
---|
393 | #if <NTL_FFT_PIPELINE> |
---|
394 | #define NTL_FFT_PIPELINE |
---|
395 | |
---|
396 | /* |
---|
397 | * If using NTL_AVOID_BRANCHING, you might want to try this as well. |
---|
398 | * This causes the FFT routine to use a software pipeline. |
---|
399 | * |
---|
400 | * To re-build after changing this flag: rm FFT.o; make ntl.a |
---|
401 | */ |
---|
402 | |
---|
403 | #endif |
---|
404 | |
---|
405 | |
---|
406 | /* The following flag is not set by the configuration wizard; its use |
---|
407 | * is not generally recommended. |
---|
408 | */ |
---|
409 | |
---|
410 | |
---|
411 | #if 0 |
---|
412 | #define NTL_FAST_INT_MUL |
---|
413 | |
---|
414 | /* |
---|
415 | * Really esoteric. |
---|
416 | * If using NTL_SINGLE_MUL, and your machine |
---|
417 | * has a fast integer multiply instruction, this might yield |
---|
418 | * faster code. Experiment! |
---|
419 | * |
---|
420 | * Irrelevent when NTL_GMP_LIP is set. |
---|
421 | * |
---|
422 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
423 | */ |
---|
424 | |
---|
425 | #endif |
---|
426 | |
---|
427 | |
---|
428 | |
---|
429 | WIZARD_HACK |
---|
430 | |
---|
431 | |
---|
432 | |
---|
433 | #endif |
---|