1 /****************************************************************
2 Copyright (C) 1997, 1998 Lucent Technologies
5 Permission to use, copy, modify, and distribute this software and
6 its documentation for any purpose and without fee is hereby
7 granted, provided that the above copyright notice appear in all
8 copies and that both that the copyright notice and this
9 permission notice and warranty disclaimer appear in supporting
10 documentation, and that the name of Lucent or any of its entities
11 not be used in advertising or publicity pertaining to
12 distribution of the software without specific, written prior
15 LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
17 IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
18 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
20 IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
21 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
23 ****************************************************************/
25 /* Try to deduce arith.h from arithmetic properties. */
37 IEEE_8087
= { "IEEE_8087", 1 },
38 IEEE_MC68k
= { "IEEE_MC68k", 2 },
55 if (sizeof(x
) > 2*(sizeof(double) + sizeof(long)))
59 if (u
.L
[0] == 1117925532 && u
.L
[1] == -448790528)
61 if (u
.L
[1] == 1117925532 && u
.L
[0] == -448790528)
63 if (u
.L
[0] == -2065213935 && u
.L
[1] == 10752)
65 if (u
.L
[0] == 1267827943 && u
.L
[1] == 704643072)
82 if (sizeof(x
) > 2*(sizeof(double) + sizeof(int)))
86 if (u
.L
[0] == 1117925532 && u
.L
[1] == -448790528)
88 if (u
.L
[1] == 1117925532 && u
.L
[0] == -448790528)
90 if (u
.L
[0] == -2065213935 && u
.L
[1] == 10752)
92 if (u
.L
[0] == 1267827943 && u
.L
[1] == 704643072)
97 char *emptyfmt
= ""; /* avoid possible warning message with printf("") */
108 /* Cray1 = 4617762693716115456 -- without overflow on non-Crays */
109 Cray1
= printf(emptyfmt
) < 0 ? 0 : 4617762;
110 if (printf(emptyfmt
, Cray1
) >= 0)
111 Cray1
= 1000000*Cray1
+ 693716;
112 if (printf(emptyfmt
, Cray1
) >= 0)
113 Cray1
= 1000000*Cray1
+ 115456;
128 for(i
= 155;; b
*= b
, i
>>= 1) {
146 #ifdef WRITE_ARITH_H /* for Symantec's buggy "make" */
147 f
= fopen("arith.h", "w");
149 printf("Cannot open arith.h\n");
156 if (sizeof(double) == 2*sizeof(long))
158 else if (sizeof(double) == 2*sizeof(int)) {
162 else if (sizeof(double) == sizeof(long))
165 fprintf(f
, "#define %s\n#define Arith_Kind_ASL %d\n",
168 fprintf(f
, "#define Long int\n#define Intcast (int)(long)\n");
170 fprintf(f
, "#define Double_Align\n");
171 if (sizeof(char*) == 8)
172 fprintf(f
, "#define X64_bit_pointers\n");
174 if (sizeof(long long) < 8)
176 fprintf(f
, "#define NO_LONG_LONG\n");
177 if (a
->kind
<= 2 && fzcheck())
178 fprintf(f
, "#define Sudden_Underflow\n");
181 fprintf(f
, "/* Unknown arithmetic */\n");