1 | /*****************************************************************************\ |
---|
2 | * Computer Algebra System SINGULAR |
---|
3 | \*****************************************************************************/ |
---|
4 | /** @file auxiliary.h |
---|
5 | * |
---|
6 | * All the auxiliary stuff. |
---|
7 | * |
---|
8 | * ABSTRACT: we shall put here everything that does not have its own place. |
---|
9 | * |
---|
10 | * @author Oleksandr Motsak |
---|
11 | * |
---|
12 | * @internal @version \$Id$ |
---|
13 | * |
---|
14 | **/ |
---|
15 | /*****************************************************************************/ |
---|
16 | |
---|
17 | #ifndef MISC_AUXILIARY_H |
---|
18 | #define MISC_AUXILIARY_H |
---|
19 | |
---|
20 | // ----------------- configure stuff |
---|
21 | |
---|
22 | /* CPU type: i[3456]86: */ |
---|
23 | #undef SI_CPU_I386 |
---|
24 | /* CPU type: sparc: */ |
---|
25 | #undef SI_CPU_SPARC |
---|
26 | /* CPU type: ppc: */ |
---|
27 | #undef SI_CPU_PPC |
---|
28 | /* CPU type: IA64: */ |
---|
29 | #undef SI_CPU_IA64 |
---|
30 | /* CPU type: x86_64: */ |
---|
31 | #undef SI_CPU_X86_64 |
---|
32 | |
---|
33 | /* Define sizeof(long) */ |
---|
34 | #define SIZEOF_LONG 4 |
---|
35 | |
---|
36 | // ----------------- end of configure stuff |
---|
37 | |
---|
38 | // BOOLEAN |
---|
39 | |
---|
40 | #if (SIZEOF_LONG == 8) |
---|
41 | typedef int BOOLEAN; |
---|
42 | /* testet on x86_64, gcc 3.4.6: 2 % */ |
---|
43 | /* testet on IA64, gcc 3.4.6: 1 % */ |
---|
44 | #else |
---|
45 | /* testet on athlon, gcc 2.95.4: 1 % */ |
---|
46 | typedef short BOOLEAN; |
---|
47 | #endif |
---|
48 | |
---|
49 | #ifndef FALSE |
---|
50 | #define FALSE 0 |
---|
51 | #endif |
---|
52 | |
---|
53 | #ifndef TRUE |
---|
54 | #define TRUE 1 |
---|
55 | #endif |
---|
56 | |
---|
57 | #ifndef NULL |
---|
58 | #define NULL (0) |
---|
59 | #endif |
---|
60 | |
---|
61 | // #ifdef _TRY |
---|
62 | #ifndef ABS |
---|
63 | #define ABS(x) ((x)<0?(-(x)):(x)) |
---|
64 | #endif |
---|
65 | // #endif |
---|
66 | |
---|
67 | static const int MAX_INT_LEN= 11; |
---|
68 | typedef void* ADDRESS; |
---|
69 | |
---|
70 | #define loop for(;;) |
---|
71 | |
---|
72 | static inline int si_max(const int a, const int b) { return (a>b) ? a : b; } |
---|
73 | |
---|
74 | |
---|
75 | #if defined(SI_CPU_I386) || defined(SI_CPU_X86_64) |
---|
76 | // the following settings seems to be better on i386 and x86_64 processors |
---|
77 | // define if a*b is with mod instead of tables |
---|
78 | #define HAVE_MULT_MOD |
---|
79 | // #define HAVE_GENERIC_ADD |
---|
80 | // #ifdef HAVE_MULT_MOD |
---|
81 | // #define HAVE_DIV_MOD |
---|
82 | // #endif |
---|
83 | #elif defined(SI_CPU_IA64) |
---|
84 | // the following settings seems to be better on itanium processors |
---|
85 | // #define HAVE_MULT_MOD |
---|
86 | #define HAVE_GENERIC_ADD |
---|
87 | // #ifdef HAVE_MULT_MOD |
---|
88 | // #define HAVE_DIV_MOD |
---|
89 | // #endif |
---|
90 | #elif defined(SI_CPU_SPARC) |
---|
91 | // #define HAVE_GENERIC_ADD |
---|
92 | #define HAVE_MULT_MOD |
---|
93 | #ifdef HAVE_MULT_MOD |
---|
94 | #define HAVE_DIV_MOD |
---|
95 | #endif |
---|
96 | #elif defined(SI_CPU_PPC) |
---|
97 | // the following settings seems to be better on ppc processors |
---|
98 | // testet on: ppc_Linux, 740/750 PowerMac G3, 512k L2 cache |
---|
99 | #define HAVE_MULT_MOD |
---|
100 | // #ifdef HAVE_MULT_MOD |
---|
101 | // #define HAVE_DIV_MOD |
---|
102 | // #endif |
---|
103 | #endif |
---|
104 | |
---|
105 | |
---|
106 | #endif |
---|
107 | /* MISC_AUXILIARY_H */ |
---|
108 | |
---|