2 * Sources of the "CONVERT" group instructions
5 /* $Id: do_conv.c,v 2.5 1994/06/24 10:46:17 ceriel Exp $ */
23 /* CII -: Convert integer to integer (*) */
24 register int newsize = swpop();
29 switch ((int)(10 * swpop() + newsize)) {
32 wtrap(WILLCONV, EILLINS);
41 wtrap(WILLCONV, EILLINS);
49 wtrap(WILLCONV, EILLINS);
52 if (must_test && !(IgnMask&BIT(ECONV))) {
53 if (s < I_MINS2 || s > I_MAXS2)
61 wtrap(WILLCONV, EILLINS);
67 /* CUI -: Convert unsigned to integer (*) */
68 register int newsize = swpop();
69 register unsigned long u;
73 switch ((int)(10 * swpop() + newsize)) {
76 wtrap(WILLCONV, EILLINS);
79 if (must_test && !(IgnMask&BIT(ECONV))) {
87 wtrap(WILLCONV, EILLINS);
89 npush((long) upop(2L), 4L);
93 wtrap(WILLCONV, EILLINS);
96 if (must_test && !(IgnMask&BIT(ECONV))) {
104 if (must_test && !(IgnMask&BIT(ECONV))) {
111 wtrap(WILLCONV, EILLINS);
117 /* CFI -: Convert floating to integer (*) */
119 register int newsize = swpop();
122 LOG(("@C6 DoCFI()"));
124 switch ((int)(10 * swpop() + newsize)) {
127 wtrap(WILLCONV, EILLINS);
130 if (must_test && !(IgnMask&BIT(ECONV))) {
131 if (f <= (FL_MINS2 - 1.0) || f > FL_MAXS2)
138 if (must_test && !(IgnMask&BIT(ECONV))) {
139 if (f <= (FL_MINS4 - 1.0) || f > FL_MAXS4)
146 wtrap(WILLCONV, EILLINS);
149 if (must_test && !(IgnMask&BIT(ECONV))) {
150 if (f <= (FL_MINS2 - 1.0) || f > FL_MAXS2)
157 if (must_test && !(IgnMask&BIT(ECONV))) {
158 if (f <= (FL_MINS4 - 1.0) || f > FL_MAXS4)
164 wtrap(WILLCONV, EILLINS);
173 /* CIF -: Convert integer to floating (*) */
175 register int newsize = swpop();
177 LOG(("@C6 DoCIF()"));
179 switch ((int)(10 * swpop() + newsize)) {
182 wtrap(WILLCONV, EILLINS);
184 fpush((double) spop(2L), 4L);
188 wtrap(WILLCONV, EILLINS);
190 fpush((double) spop(2L), 8L);
193 fpush((double) spop(4L), 4L);
196 fpush((double) spop(4L), 8L);
199 wtrap(WILLCONV, EILLINS);
208 /* CUF -: Convert unsigned to floating (*) */
210 register int newsize = swpop();
211 register unsigned long u;
213 LOG(("@C6 DoCUF()"));
215 switch ((int)(10 * swpop() + newsize)) {
218 wtrap(WILLCONV, EILLINS);
220 fpush((double) upop(2L), 4L);
224 wtrap(WILLCONV, EILLINS);
226 fpush((double) upop(2L), 8L);
229 if ((u = upop(4L)) > I_MAXS4) {
232 fpush(((double) u) - (double)(-I_MAXS4-1), 4L);
234 else fpush((double) u, 4L);
237 if ((u = upop(4L)) > I_MAXS4) {
240 fpush(((double) u) - (double)(-I_MAXS4-1), 8L);
242 else fpush((double) u, 8L);
245 wtrap(WILLCONV, EILLINS);
254 /* CFF -: Convert floating to floating (*) */
256 register int newsize = swpop();
258 LOG(("@C6 DoCFF()"));
260 switch ((int)(10 * swpop() + newsize)) {
272 wtrap(WILLCONV, EILLINS);
281 /* CIU -: Convert integer to unsigned */
282 register int newsize = swpop();
285 LOG(("@C6 DoCIU()"));
287 switch ((int)(10 * swpop() + newsize)) {
290 wtrap(WILLCONV, EILLINS);
295 wtrap(WILLCONV, EILLINS);
297 npush((long) upop(2L), 4L);
301 wtrap(WILLCONV, EILLINS);
309 wtrap(WILLCONV, EILLINS);
315 /* CUU -: Convert unsigned to unsigned */
316 register int newsize = swpop();
318 LOG(("@C6 DoCUU()"));
320 switch ((int)(10 * swpop() + newsize)) {
323 wtrap(WILLCONV, EILLINS);
328 wtrap(WILLCONV, EILLINS);
330 npush((long) upop(2L), 4L);
334 wtrap(WILLCONV, EILLINS);
336 npush((long) upop(4L), 2L);
341 wtrap(WILLCONV, EILLINS);
347 /* CFU -: Convert floating to unsigned */
349 register int newsize = swpop();
352 LOG(("@C6 DoCFU()"));
354 switch ((int)(10 * swpop() + newsize)) {
357 wtrap(WILLCONV, EILLINS);
368 wtrap(WILLCONV, EILLINS);
378 wtrap(WILLCONV, EILLINS);