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 header 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 | To set a flag, just replace the pre-processor directive |
---|
33 | 'if 0' by 'if 1' for that flag, which causes the appropriate macro |
---|
34 | to be defined. Of course, to unset a flag, just replace the |
---|
35 | 'if 1' by an 'if 0'. |
---|
36 | |
---|
37 | You can also do this more conveniently via the command line |
---|
38 | using the configure script. |
---|
39 | |
---|
40 | |
---|
41 | *************************************************************************/ |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | /************************************************************************* |
---|
46 | * |
---|
47 | * Basic Configuration Options |
---|
48 | * |
---|
49 | *************************************************************************/ |
---|
50 | |
---|
51 | |
---|
52 | /* None of these flags are set by the configuration wizard; |
---|
53 | * they must be set by hand, before installation begins. |
---|
54 | */ |
---|
55 | |
---|
56 | |
---|
57 | #if 1 |
---|
58 | #define NTL_STD_CXX |
---|
59 | |
---|
60 | /* |
---|
61 | * Use this flag if you want to use the "Standard C++" version of NTL. |
---|
62 | * In this version, all of NTL is "wrapped" inside the namespace NTL, |
---|
63 | * and are no longer directly accessible---you must either use |
---|
64 | * explicit qualification, or using directives, or using declarations. |
---|
65 | * However, note that all names that begin with "NTL_" are macros, |
---|
66 | * and as such do not belong to any namespace. |
---|
67 | * Additionally, instead of including the standard headers |
---|
68 | * <stdlib.h>, <math.h>, and <iostream.h>, the standard headers |
---|
69 | * <cstdlib>, <cmath>, and <iostream> are included. |
---|
70 | * These "wrap" some (but not all) names in namespace std. |
---|
71 | * Also, the 'nothrow' version on the 'new' operator is used. |
---|
72 | * |
---|
73 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
74 | */ |
---|
75 | |
---|
76 | #endif |
---|
77 | |
---|
78 | /* The following three flags may be used if you want to use some |
---|
79 | * of the features of Standard C++, but your compiler is deficient. |
---|
80 | * Instead of setting the NTL_STD_CXX, you can set any subset |
---|
81 | * of the these three. Setting all three of these flags is equivalent |
---|
82 | * to setting NTL_STD_CXX. No harm is done if NTL_STD_CXX is set |
---|
83 | * and some of the following three flags are set. |
---|
84 | * |
---|
85 | * To re-build after changing any of these flags: rm *.o; make ntl.a |
---|
86 | */ |
---|
87 | |
---|
88 | #if 0 |
---|
89 | #define NTL_PSTD_NNS |
---|
90 | |
---|
91 | /* Set if NTL library components are to be wrapped in namespace 'NTL'. */ |
---|
92 | |
---|
93 | #endif |
---|
94 | |
---|
95 | #if 0 |
---|
96 | #define NTL_PSTD_NHF |
---|
97 | |
---|
98 | /* Set if you want to use the new header files <cstdlib>, <cmath>, and |
---|
99 | * <iostream>, instead of the traditional header files <stdlib.h>, |
---|
100 | * <math.h>, and <iostream.h>. |
---|
101 | * If new header files are used, then it is assumed that all standard |
---|
102 | * library components are wrapped in namespace std; otherwise, |
---|
103 | * it is assumed that all standard library components are in the |
---|
104 | * global namespace. |
---|
105 | * |
---|
106 | * Also, when set, some internal NTL files use the header <fstream> |
---|
107 | * in place of <fstream.h>. |
---|
108 | */ |
---|
109 | |
---|
110 | #endif |
---|
111 | |
---|
112 | #if 0 |
---|
113 | #define NTL_PSTD_NTN |
---|
114 | |
---|
115 | /* Set if you want to use the 'nothrow' version of new. */ |
---|
116 | |
---|
117 | #endif |
---|
118 | |
---|
119 | |
---|
120 | #if 0 |
---|
121 | #define NTL_GMP_LIP |
---|
122 | |
---|
123 | /* |
---|
124 | * Use this flag if you want to use GMP as the long integer package. |
---|
125 | * This can result in significantly faster code on some platforms. |
---|
126 | * It requires that the GMP package (version >= 3.1) has already been |
---|
127 | * installed. You will also have to set the variables GMP_INCDIR, |
---|
128 | * GMP_LIBDIR, and GMP_LIB in the makefile (these are set automatically |
---|
129 | * by the confiuration script when you pass the flag NTL_GMP_LIP=on |
---|
130 | * to that script. |
---|
131 | * |
---|
132 | * Beware that setting this flag can break some older NTL codes. |
---|
133 | * If you want complete backward compatability, but not quite |
---|
134 | * the full performance of GMP, use the flag NTL_GMP_HACK below. |
---|
135 | * See the full NTL documentation for more details. |
---|
136 | * |
---|
137 | * To re-build after changing this flag: |
---|
138 | * rm *.o; make setup3; make ntl.a |
---|
139 | * You may also have to edit the makefile to modify the variables |
---|
140 | * GMP_INCDIR, GMP_LIBDIR, and GMP_LIB. |
---|
141 | */ |
---|
142 | |
---|
143 | #elif 0 |
---|
144 | #define NTL_GMP_HACK |
---|
145 | |
---|
146 | /* |
---|
147 | * Use this flag if you want to use GMP as the long integer package. |
---|
148 | * This can result in significantly faster code on some platforms. |
---|
149 | * It requires that the GMP package (version >= 2.0.2) has already been |
---|
150 | * installed. You will also have to set the variables GMP_INCDIR, |
---|
151 | * GMP_LIBDIR, and GMP_LIB in the makefile (these are set automatically |
---|
152 | * by the confiuration script when you pass the flag NTL_GMP_HACK=on |
---|
153 | * to that script. |
---|
154 | * |
---|
155 | * Unlike the NTL_GMP_LIP flag above, setting this flag maintains |
---|
156 | * complete backward compatability with older NTL codes, but |
---|
157 | * you do not get the full performance of GMP. |
---|
158 | * |
---|
159 | * To re-build after changing this flag: |
---|
160 | * rm lip.o; make setup3; make ntl.a |
---|
161 | * You may also have to edit the makefile to modify the variables |
---|
162 | * GMP_INCDIR, GMP_LIBDIR, and GMP_LIB. |
---|
163 | * |
---|
164 | */ |
---|
165 | |
---|
166 | #endif |
---|
167 | |
---|
168 | |
---|
169 | #if 0 |
---|
170 | #define NTL_LONG_LONG_TYPE long long |
---|
171 | |
---|
172 | /* |
---|
173 | * If you set the flag NTL_LONG_LONG, then the value of |
---|
174 | * NTL_LONG_LONG_TYPE will be used |
---|
175 | * to declare 'double word' signed integer types. |
---|
176 | * Irrelevant when NTL_GMP_LIP is set. |
---|
177 | * If left undefined, some "ifdef magic" will attempt |
---|
178 | * to find the best choice for your platform, depending |
---|
179 | * on the compiler and wordsize. On 32-bit machines, |
---|
180 | * this is usually 'long long'. |
---|
181 | * |
---|
182 | * To re-build after changing this flag: rm lip.o; make ntl.a |
---|
183 | */ |
---|
184 | |
---|
185 | #endif |
---|
186 | |
---|
187 | |
---|
188 | #if 0 |
---|
189 | #define NTL_UNSIGNED_LONG_LONG_TYPE unsigned long long |
---|
190 | |
---|
191 | /* |
---|
192 | * If you set the flag NTL_SPMM_ULL, then the value of |
---|
193 | * NTL_UNSIGNED_LONG_LONG_TYPE will be used |
---|
194 | * to declare 'double word' unsigned integer types. |
---|
195 | * If left undefined, some "ifdef magic" will attempt |
---|
196 | * to find the best choice for your platform, depending |
---|
197 | * on the compiler and wordsize. On 32-bit machines, |
---|
198 | * this is usually 'unsigned long long'. |
---|
199 | * |
---|
200 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
201 | */ |
---|
202 | |
---|
203 | #endif |
---|
204 | |
---|
205 | |
---|
206 | #if 0 |
---|
207 | #define NTL_CXX_ONLY |
---|
208 | |
---|
209 | /* |
---|
210 | * It is possible to compile everything using C++ only. |
---|
211 | * If you want to do this, make CC and CXX in the makefile the same. |
---|
212 | * You may also want to set this flag, which eliminates some |
---|
213 | * "C" linkage that is no longer necessary. |
---|
214 | * However, it should still work without it. |
---|
215 | * |
---|
216 | * This flag can be set independently of NTL_STD_CXX. |
---|
217 | * All functions that may have "C" linkage are never wrapped in |
---|
218 | * namespace NTL; instead, their names always start with "_ntl_", |
---|
219 | * and as such, they should not conflict with other global names. |
---|
220 | * All such names are undocumented, and should never be used |
---|
221 | * by NTL clients under normal circumstances. |
---|
222 | * |
---|
223 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
224 | */ |
---|
225 | |
---|
226 | #endif |
---|
227 | |
---|
228 | #if 0 |
---|
229 | #define NTL_CLEAN_INT |
---|
230 | |
---|
231 | /* |
---|
232 | * This will disallow the use of some non-standard integer arithmetic |
---|
233 | * that may improve performance somewhat. |
---|
234 | * |
---|
235 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
236 | */ |
---|
237 | |
---|
238 | #endif |
---|
239 | |
---|
240 | #if 0 |
---|
241 | #define NTL_CLEAN_PTR |
---|
242 | |
---|
243 | /* |
---|
244 | * This will disallow the use of some non-standard pointer arithmetic |
---|
245 | * that may improve performance somewhat. |
---|
246 | * |
---|
247 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
248 | */ |
---|
249 | |
---|
250 | #endif |
---|
251 | |
---|
252 | |
---|
253 | #if 0 |
---|
254 | #define NTL_RANGE_CHECK |
---|
255 | |
---|
256 | /* |
---|
257 | * This will generate vector subscript range-check code. |
---|
258 | * Useful for debugging, but it slows things down of course. |
---|
259 | * |
---|
260 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
261 | */ |
---|
262 | |
---|
263 | #endif |
---|
264 | |
---|
265 | |
---|
266 | |
---|
267 | |
---|
268 | |
---|
269 | #if 0 |
---|
270 | #define NTL_NO_INIT_TRANS |
---|
271 | |
---|
272 | /* |
---|
273 | * Without this flag, NTL uses a special code sequence to avoid |
---|
274 | * copying large objects in return statements. However, if your |
---|
275 | * compiler optimizes away the return of a *named* local object, |
---|
276 | * this is not necessary, and setting this flag will result |
---|
277 | * in *slightly* more compact and efficient code. Although |
---|
278 | * the emeriging C++ standard allows compilers to perform |
---|
279 | * this optimization, I know of none that currently do. |
---|
280 | * Most will avoid copying *temporary* objects in return statements, |
---|
281 | * and NTL's default code sequence exploits this fact. |
---|
282 | * |
---|
283 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
284 | */ |
---|
285 | |
---|
286 | #endif |
---|
287 | |
---|
288 | |
---|
289 | #if 0 |
---|
290 | #define NTL_X86_FIX |
---|
291 | |
---|
292 | /* |
---|
293 | * Forces the "x86 floating point fix", overriding the default behavior. |
---|
294 | * By default, NTL will apply the "fix" if it looks like it is |
---|
295 | * necessary, and if knows how to fix it. |
---|
296 | * The problem addressed here is that x86 processors sometimes |
---|
297 | * run in a mode where FP registers have more precision than doubles. |
---|
298 | * This will cause code in quad_float.c some trouble. |
---|
299 | * NTL can normally correctly detect the problem, and fix it, |
---|
300 | * so you shouldn't need to worry about this or the next flag. |
---|
301 | |
---|
302 | * To re-build after changing this flag: rm quad_float.o; make ntl.a |
---|
303 | * |
---|
304 | */ |
---|
305 | |
---|
306 | #elif 0 |
---|
307 | #define NTL_NO_X86_FIX |
---|
308 | /* |
---|
309 | * Forces no "x86 floating point fix", overriding the default behavior. |
---|
310 | |
---|
311 | * To re-build after changing this flag: rm quad_float.o; make ntl.a |
---|
312 | */ |
---|
313 | |
---|
314 | #endif |
---|
315 | |
---|
316 | |
---|
317 | |
---|
318 | |
---|
319 | /************************************************************************* |
---|
320 | * |
---|
321 | * Performance Options |
---|
322 | * |
---|
323 | *************************************************************************/ |
---|
324 | |
---|
325 | |
---|
326 | /* One can choose one of four different stragtegies for long integer |
---|
327 | * arithmetic: the default, NTL_LONG_LONG, NTL_AVOID_FLOAT, or NTL_SINGLE_MUL. |
---|
328 | * The configuration wizard will choose among the first three; the use of |
---|
329 | * NTL_SINGLE_MUL is only allowed if NTL_CLEAN_INT is not set, and its |
---|
330 | * use is not recommended. |
---|
331 | * |
---|
332 | * These flags are irrelevant when NTL_GMP_LIP is set, and are simply ignored, |
---|
333 | * except for NTL_SINGLE_MUL -- setting that causes a complie-time error. |
---|
334 | * |
---|
335 | */ |
---|
336 | |
---|
337 | #if 0 |
---|
338 | #define NTL_LONG_LONG |
---|
339 | |
---|
340 | /* |
---|
341 | * |
---|
342 | * For platforms that support it, this flag can be set to cause |
---|
343 | * the low-level multiplication code to use the type "long long", |
---|
344 | * which may yield a significant performance gain, |
---|
345 | * but on others, it can yield no improvement and can even |
---|
346 | * slow things down. |
---|
347 | * |
---|
348 | * |
---|
349 | * See below (NTL_LONG_LONG_TYPE) for how to use a type name |
---|
350 | * other than "long long". |
---|
351 | * |
---|
352 | * If you set NTL_LONG_LONG, you might also want to set |
---|
353 | * the flag NTL_TBL_REM (see below). |
---|
354 | * |
---|
355 | * To re-build after changing this flag: rm lip.o; make ntl.a |
---|
356 | */ |
---|
357 | |
---|
358 | #elif 0 |
---|
359 | #define NTL_AVOID_FLOAT |
---|
360 | |
---|
361 | /* |
---|
362 | * |
---|
363 | * On machines with slow floating point or---more comminly---slow int/float |
---|
364 | * conversions, this flag can lead to faster code. |
---|
365 | * |
---|
366 | * If you set NTL_AVOID_FLOAT, you should probably also |
---|
367 | * set NTL_TBL_REM (see below). |
---|
368 | * |
---|
369 | * To re-build after changing this flag: rm lip.o; make ntl.a |
---|
370 | */ |
---|
371 | |
---|
372 | #elif 0 |
---|
373 | #define NTL_SINGLE_MUL |
---|
374 | |
---|
375 | /* This was developed originally to improve performance on |
---|
376 | * ancient Sparc stations that did not have built-in integer mul |
---|
377 | * instructions. Unless you have such an old-timer, I would not |
---|
378 | * recommend using this option. This option only works on |
---|
379 | * 32-bit machines with IEEE floating point, and is not truly |
---|
380 | * portable. If you use this option, you get a 26-bit radix. |
---|
381 | * |
---|
382 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
383 | */ |
---|
384 | |
---|
385 | #endif |
---|
386 | |
---|
387 | |
---|
388 | /* There are four strategies to implmement single-precision |
---|
389 | * modular multiplication with precondinition (see the MulModPrecon |
---|
390 | * function in the ZZ module): the default, NTL_SPMM_UL, and NTL_SPMM_ULL, |
---|
391 | * and NTL_SPMM_ASM. |
---|
392 | * This plays a crucial role in the "small prime FFT" used to |
---|
393 | * implement polynomial arithmetic, and in other CRT-based methods |
---|
394 | * (such as linear algebra over ZZ), as well as polynomial andd matrix |
---|
395 | * arithmetic over zz_p. |
---|
396 | */ |
---|
397 | |
---|
398 | |
---|
399 | #if 0 |
---|
400 | #define NTL_SPMM_UL |
---|
401 | |
---|
402 | /* The default MulModPrecon implementation uses a mix of |
---|
403 | * int and float arithmetic, which may be slow on certain machines. |
---|
404 | * This flag causes an "all integer" implementation to be used. |
---|
405 | * It is entirely portable. |
---|
406 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
407 | */ |
---|
408 | |
---|
409 | |
---|
410 | |
---|
411 | #elif 0 |
---|
412 | #define NTL_SPMM_ULL |
---|
413 | |
---|
414 | /* Like this previous flag, this also causes an "all integer" |
---|
415 | * implementation of MulModPrecon to be used. |
---|
416 | * It us usually a faster implementation, |
---|
417 | * but it is not enturely portable. |
---|
418 | * It relies on double-word unsigned multiplication |
---|
419 | * (see NTL_UNSIGNED_LONG_LONG_TYPE above). |
---|
420 | * |
---|
421 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
422 | */ |
---|
423 | |
---|
424 | #elif 0 |
---|
425 | #define NTL_SPMM_ASM |
---|
426 | |
---|
427 | /* Like this previous two flag, this also causes an "all integer" |
---|
428 | * implementation of MulModPrecon to be used. |
---|
429 | * It relies assembler code to do double-word unsigned multiplication. |
---|
430 | * This is only supported on a select mechines under GCC. |
---|
431 | * |
---|
432 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
433 | */ |
---|
434 | |
---|
435 | |
---|
436 | #endif |
---|
437 | |
---|
438 | |
---|
439 | |
---|
440 | |
---|
441 | |
---|
442 | /* The next five flags NTL_AVOID_BRANCHING, NTL_TBL_REM, |
---|
443 | * NTL_GF2X_ALTCODE, NTL_GF2X_ALTCODE1, and NTL_GF2X_NOINLINE |
---|
444 | * are also set by the configuration wizard. |
---|
445 | */ |
---|
446 | |
---|
447 | |
---|
448 | |
---|
449 | #if 0 |
---|
450 | #define NTL_AVOID_BRANCHING |
---|
451 | |
---|
452 | /* |
---|
453 | * With this option, branches are replaced at several |
---|
454 | * key points with equivalent code using shifts and masks. |
---|
455 | * It may speed things up on machines with |
---|
456 | * deep pipelines and high branch penalities. |
---|
457 | * This flag mainly affects the implementation of the |
---|
458 | * single-precision modular arithmetic routines. |
---|
459 | * |
---|
460 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
461 | */ |
---|
462 | |
---|
463 | #endif |
---|
464 | |
---|
465 | |
---|
466 | |
---|
467 | #if 0 |
---|
468 | #define NTL_TBL_REM |
---|
469 | |
---|
470 | /* |
---|
471 | * |
---|
472 | * With this flag, some divisions are avoided in the |
---|
473 | * ZZ_pX multiplication routines. If you use the NTL_AVOID_FLOAT |
---|
474 | * or NTL_LONG_LONG flags, then you should probably use this one too. |
---|
475 | * |
---|
476 | * Irrelevent when NTL_GMP_LIP is set. |
---|
477 | * |
---|
478 | * To re-build after changing this flag: |
---|
479 | * rm lip.o; make ntl.a |
---|
480 | */ |
---|
481 | |
---|
482 | #endif |
---|
483 | |
---|
484 | |
---|
485 | #if 0 |
---|
486 | #define NTL_GF2X_ALTCODE |
---|
487 | |
---|
488 | /* |
---|
489 | * With this option, the default strategy for implmenting low-level |
---|
490 | * GF2X multiplication is replaced with an alternative strategy. |
---|
491 | * This alternative strategy seems to work better on RISC machines |
---|
492 | * with deep pipelines and high branch penalties (like a powerpc), |
---|
493 | * but does no better (or even worse) on x86s. |
---|
494 | * |
---|
495 | * To re-build after changing this flag: rm GF2X.o; make ntl.a |
---|
496 | */ |
---|
497 | |
---|
498 | #elif 0 |
---|
499 | #define NTL_GF2X_ALTCODE1 |
---|
500 | |
---|
501 | |
---|
502 | /* |
---|
503 | * Yest another alternative strategy for implementing GF2X |
---|
504 | * multiplication. |
---|
505 | * |
---|
506 | * To re-build after changing this flag: rm GF2X.o; make ntl.a |
---|
507 | */ |
---|
508 | |
---|
509 | |
---|
510 | #endif |
---|
511 | |
---|
512 | #if 0 |
---|
513 | #define NTL_GF2X_NOINLINE |
---|
514 | |
---|
515 | /* |
---|
516 | * By default, the low-level GF2X multiplication routine in inlined. |
---|
517 | * This can potentially lead to some trouble on some platforms, |
---|
518 | * and you can override the default by setting this flag. |
---|
519 | * |
---|
520 | * To re-build after changing this flag: rm GF2X.o; make ntl.a |
---|
521 | */ |
---|
522 | |
---|
523 | #endif |
---|
524 | |
---|
525 | |
---|
526 | |
---|
527 | |
---|
528 | /* The following flag is not set by the configuration wizard; its use |
---|
529 | * is not generally recommended. |
---|
530 | */ |
---|
531 | |
---|
532 | |
---|
533 | #if 0 |
---|
534 | #define NTL_FAST_INT_MUL |
---|
535 | |
---|
536 | /* |
---|
537 | * Really esoteric. |
---|
538 | * If using NTL_SINGLE_MUL, and your machine |
---|
539 | * has a fast integer multiply instruction, this might yield |
---|
540 | * faster code. Experiment! |
---|
541 | * |
---|
542 | * Irrelevent when NTL_GMP_LIP is set. |
---|
543 | * |
---|
544 | * To re-build after changing this flag: rm *.o; make ntl.a |
---|
545 | */ |
---|
546 | |
---|
547 | #endif |
---|
548 | |
---|
549 | |
---|
550 | |
---|
551 | |
---|
552 | |
---|
553 | |
---|
554 | |
---|
555 | #endif |
---|