Commit | Line | Data |
---|---|---|
783a9e69 | 1 | /* |
bcf1365c DF |
2 | * Copyright (c) 1982 Regents of the University of California. |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
783a9e69 | 5 | */ |
bcf1365c | 6 | |
783a9e69 | 7 | #ifndef lint |
bcf1365c | 8 | static char sccsid[] = "@(#)floattab.c 5.1 (Berkeley) %G%"; |
783a9e69 RH |
9 | #endif not lint |
10 | ||
11 | #include <stdio.h> | |
12 | #include "as.h" | |
13 | #define N NOTAKE | |
14 | ||
15 | struct ty_bigdesc ty_bigdesc[] = { | |
16 | { /* TYPB */ | |
17 | { 15, N, N, N, N, N, N, N, N, N, N, N, N, N, N, N }, | |
18 | { N, N, N, N, N, N, N, N, N, N, N, N, N, N, N, 0 }, | |
19 | { N, N }, | |
20 | { N, N }, | |
21 | 0, /* mantissa lshift */ | |
22 | 0, /* exponent rshift */ | |
23 | 8, /* mantissa sig bits */ | |
24 | 0, /* exponent sig bits */ | |
25 | 8, /* exponent excess */ | |
26 | }, | |
27 | { /* TYPW */ | |
28 | { 14, 15, N, N, N, N, N, N, N, N, N, N, N, N, N, N }, | |
29 | { N, N, N, N, N, N, N, N, N, N, N, N, N, N, 0, 1 }, | |
30 | { N, N}, | |
31 | { N, N}, | |
32 | 0, /* mantissa lshift */ | |
33 | 0, /* exponent rshift */ | |
34 | 16, /* mantissa sig bits */ | |
35 | 0, /* exponent sig bits */ | |
36 | 16, /* exponent excess */ | |
37 | }, | |
38 | { /* TYPL */ | |
39 | { 12, 13, 14, 15, N, N, N, N, N, N, N, N, N, N, N, N }, | |
40 | { N, N, N, N, N, N, N, N, N, N, N, N, 0, 1, 2, 3 }, | |
41 | { N, N }, | |
42 | { N, N }, | |
43 | 0, /* mantissa lshift */ | |
44 | 0, /* exponent rshift */ | |
45 | 32, /* mantissa sig bits */ | |
46 | 0, /* exponent sig bits */ | |
47 | 32, /* exponent excess */ | |
48 | }, | |
49 | { /* TYPQ */ | |
50 | { 8, 9, 10, 11, 12, 13, 14, 15, N, N, N, N, N, N, N, N }, | |
51 | { N, N, N, N, N, N, N, N, 0, 1, 2, 3, 4, 5, 6, 7 }, | |
52 | { N, N }, | |
53 | { N, N }, | |
54 | 0, /* mantissa lshift */ | |
55 | 0, /* exponent rshift */ | |
56 | 64, /* mantissa sig bits */ | |
57 | 0, /* exponent sig bits */ | |
58 | 64, /* exponent excess */ | |
59 | }, | |
60 | { /* TYPO */ | |
61 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, | |
62 | { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, | |
63 | { N, N }, | |
64 | { N, N }, | |
65 | 0, /* mantissa lshift */ | |
66 | 0, /* exponent rshift */ | |
67 | 128, /* mantissa sig bits */ | |
68 | 0, /* exponent sig bits */ | |
69 | 128, /* exponent excess */ | |
70 | }, | |
71 | { /* TYPF */ | |
72 | { 15, N, 13, 14, N, N, N, N, N, N, N, N, N, N, N, N }, | |
73 | { N, N, N, N, N, N, N, N, N, N, N, N, N, 2, 3, 0 }, | |
74 | { 0, 1 }, | |
75 | { 0, 1 }, | |
76 | 1, /* mantissa lshift */ | |
77 | 7, /* exponent rshift */ | |
78 | 24, /* mantissa sig bits */ | |
79 | 8, /* exponent sig bits */ | |
80 | 128 /* exponent excess */ | |
81 | }, | |
82 | { /* TYPD */ | |
83 | { 15, N, 13, 14, 11, 12, 9, 10, N, N, N, N, N, N, N, N }, | |
84 | { N, N, N, N, N, N, N, N, N, 6, 7, 4, 5, 2, 3, 0 }, | |
85 | { 0, 1 }, | |
86 | { 0, 1 }, | |
87 | 1, /* mantissa lshift */ | |
88 | 7, /* exponent rshift */ | |
89 | 56, /* mantissa sig bits */ | |
90 | 8, /* exponent sig bits */ | |
91 | 128 /* exponent excess */ | |
92 | }, | |
93 | { /* TYPG */ | |
94 | { 15, N, 13, 14, 11, 12, 9, 10, N, N, N, N, N, N, N, N }, | |
95 | { N, N, N, N, N, N, N, N, N, 6, 7, 4, 5, 2, 3, 0 }, | |
96 | { 0, 1 }, | |
97 | { 0, 1 }, | |
98 | 4, /* mantissa lshift */ | |
99 | 4, /* exponent rshift */ | |
100 | 53, /* mantissa sig bits */ | |
101 | 11, /* exponent sig bits */ | |
102 | 1024 /* exponent excess */ | |
103 | }, | |
104 | { /* TYPH */ | |
105 | { N, N, 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3 }, | |
106 | { N, N, 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3 }, | |
107 | { 0, 1 }, | |
108 | { 0, 1 }, | |
109 | 0, /* mantissa lshift */ | |
110 | 0, /* exponent rshift */ | |
111 | 113, /* mantissa sig bits */ | |
112 | 15, /* exponent sig bits */ | |
113 | 16384 /* exponent excess */ | |
114 | }, | |
115 | {0} /* TYPNONE */ | |
116 | }; | |
117 | ||
118 | cfloattab() | |
119 | { | |
120 | reg struct ty_bigdesc *p; | |
121 | reg int i; | |
122 | reg int j; | |
123 | reg int k; | |
124 | extern int ty_float[]; | |
125 | ||
126 | for (i = 0; i < TYPNONE - 1; i++){ | |
127 | p = &ty_bigdesc[i]; | |
128 | for (j = 0; j < 16; j++){ | |
129 | if (((char)p->b_upmmap[j]) != NOTAKE){ | |
130 | k = p->b_pmmap[p->b_upmmap[j]]; | |
131 | if (j != k) | |
132 | printf("%s:p[up[%d]] == %d\n", | |
133 | ty_string[i],j,k); | |
134 | } | |
135 | ||
136 | if (((char)p->b_pmmap[j]) != NOTAKE){ | |
137 | k = p->b_upmmap[p->b_pmmap[j]]; | |
138 | if (j != k) | |
139 | printf("%s:up[p[%d]] == %d\n", | |
140 | ty_string[i],j,k); | |
141 | } | |
142 | } | |
143 | if (!ty_float[i]) | |
144 | continue; | |
145 | k = (p->b_msigbits - 1) + p->b_mlshift; | |
146 | if (k % 8) | |
147 | printf("sigbits: %d, lshift: %d, excess: %d\n", | |
148 | p->b_msigbits, p->b_mlshift, k % 8); | |
149 | if ((15 - (k / 8)) < 0) | |
150 | printf("lsbyte <= 0\n"); | |
151 | if ( (8 - (p->b_mlshift + 2)) <= 0) | |
152 | printf("Shifted byte 15 into byte 14"); | |
153 | if ( 1 << (p->b_esigbits - 1) != p->b_eexcess) | |
154 | printf("sigbits == %d, excess = %d\n", | |
155 | p->b_esigbits, p->b_eexcess); | |
156 | } | |
157 | } |