1 /* Scicos
2 *
3 * Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 * See the file ./license.txt
20 */
21 /*--------------------------------------------------------------------------*/
22 #include <math.h>
23 #include <memory.h>
24 #include "scicos.h"
25 #include "scicos_block4.h"
26 #include "scicos_print.h"
27 #include "localization.h"
28 #include "sci_malloc.h"
29 #include "dynlib_scicos_blocks.h"
30 /*--------------------------------------------------------------------------*/
convert(scicos_block * block,int flag)31 SCICOS_BLOCKS_IMPEXP void convert(scicos_block *block, int flag)
32 {
33 int m = 0, n = 0, i = 0;
34 int *ipar = NULL;
35 double v = 0., w = 0., k = 0.;
36
37 m = GetInPortRows(block, 1);
38 n = GetInPortCols(block, 1);
39 ipar = GetIparPtrs(block);
40
41 if ((flag == 1) | (flag == 6))
42 {
43 switch (*ipar)
44 {
45 case 1:
46 {
47 void *u = NULL, *y = NULL;
48 int so;
49 so = GetSizeOfOut(block, 1);
50 u = GetInPortPtrs(block, 1);
51 y = GetOutPortPtrs(block, 1);
52 memcpy(y, u, m * n * so);
53 break;
54 }
55 case 2:
56 {
57 SCSREAL_COP *u = NULL;
58 SCSINT32_COP *y = NULL;
59 u = GetRealInPortPtrs(block, 1);
60 y = Getint32OutPortPtrs(block, 1);
61 k = pow(2, 32);
62 for (i = 0; i < m * n; i++)
63 {
64 v = (double)u[i];
65 w = v - (double)((int)(v / k)) * k;
66 if (fabs(w) > k / 2 - 1)
67 {
68 if (w >= 0)
69 {
70 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
71 }
72 else
73 {
74 w = -(-(k / 2) + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
75 }
76 }
77 y[i] = (SCSINT32_COP)w;
78 }
79 break;
80 }
81 case 3:
82 {
83 SCSREAL_COP *u = NULL;
84 SCSINT16_COP *y = NULL;
85 u = GetRealInPortPtrs(block, 1);
86 y = Getint16OutPortPtrs(block, 1);
87 k = pow(2, 16);
88 for (i = 0; i < m * n; i++)
89 {
90 v = (double)u[i];
91 w = v - (double)((int)(v / k)) * k;
92 if (fabs(w) > k / 2 - 1)
93 {
94 if (w >= 0)
95 {
96 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
97 }
98 else
99 {
100 w = -(-(k / 2) + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
101 }
102 }
103 y[i] = (SCSINT16_COP)w;
104 }
105 break;
106 }
107 case 4:
108 {
109 SCSREAL_COP *u = NULL;
110 SCSINT8_COP *y = NULL;
111 u = GetRealInPortPtrs(block, 1);
112 y = Getint8OutPortPtrs(block, 1);
113 k = pow(2, 8);
114 for (i = 0; i < m * n; i++)
115 {
116 v = (double)u[i];
117 w = v - (double)((int)(v / k)) * k;
118 if (fabs(w) > k / 2 - 1)
119 {
120 if (w >= 0)
121 {
122 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
123 }
124 else
125 {
126 w = -(-(k / 2) + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
127 }
128 }
129 y[i] = (SCSINT8_COP)w;
130 }
131 break;
132 }
133 case 5:
134 {
135 SCSREAL_COP *u = NULL;
136 SCSUINT32_COP *y = NULL;
137 u = GetRealInPortPtrs(block, 1);
138 y = Getuint32OutPortPtrs(block, 1);
139 k = pow(2, 32);
140 for (i = 0; i < m * n; i++)
141 {
142 v = (double)u[i];
143 w = v - (double)((int)(v / k)) * k;
144 y[i] = (SCSUINT32_COP)w;
145 }
146 break;
147 }
148 case 6:
149 {
150 SCSREAL_COP *u = NULL;
151 SCSUINT16_COP *y = NULL;
152 u = GetRealInPortPtrs(block, 1);
153 y = Getuint16OutPortPtrs(block, 1);
154 k = pow(2, 16);
155 for (i = 0; i < m * n; i++)
156 {
157 v = (double)u[i];
158 w = v - (double)((int)(v / k)) * k;
159 y[i] = (SCSUINT16_COP)w;
160 }
161 break;
162 }
163 case 7:
164 {
165 SCSREAL_COP *u = NULL;
166 SCSUINT8_COP *y = NULL;
167 u = GetRealInPortPtrs(block, 1);
168 y = Getuint8OutPortPtrs(block, 1);
169 k = pow(2, 8);
170 for (i = 0; i < m * n; i++)
171 {
172 v = (double)u[i];
173 w = v - (double)((int)(v / k)) * k;
174 y[i] = (SCSUINT8_COP)w;
175 }
176 break;
177 }
178 case 8:
179 {
180 SCSINT32_COP *u = NULL;
181 SCSREAL_COP *y = NULL;
182 u = Getint32InPortPtrs(block, 1);
183 y = GetRealOutPortPtrs(block, 1);
184 for (i = 0; i < m * n; i++)
185 {
186 y[i] = (SCSREAL_COP) u[i];
187 }
188 break;
189 }
190 case 9:
191 {
192 SCSINT32_COP *u = NULL;
193 SCSINT16_COP *y = NULL;
194 u = Getint32InPortPtrs(block, 1);
195 y = Getint16OutPortPtrs(block, 1);
196 k = pow(2, 16);
197 for (i = 0; i < m * n; i++)
198 {
199 v = (double)u[i];
200 w = v - (double)((int)(v / k)) * k;
201 if (fabs(w) > k / 2 - 1)
202 {
203 if (w >= 0)
204 {
205 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
206 }
207 else
208 {
209 w = -(-(k / 2) + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
210 }
211 }
212 y[i] = (SCSINT16_COP)w;
213 }
214 break;
215 }
216 case 10:
217 {
218 SCSINT32_COP *u = NULL;
219 SCSINT8_COP *y = NULL;
220 u = Getint32InPortPtrs(block, 1);
221 y = Getint8OutPortPtrs(block, 1);
222 k = pow(2, 8);
223 for (i = 0; i < m * n; i++)
224 {
225 v = (double)u[i];
226 w = v - (double)((int)(v / k)) * k;
227 if (fabs(w) > k / 2 - 1)
228 {
229 if (w >= 0)
230 {
231 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
232 }
233 else
234 {
235 w = -(-(k / 2) + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
236 }
237 }
238 y[i] = (SCSINT8_COP)w;
239 }
240 break;
241 }
242 case 11:
243 {
244 SCSINT32_COP *u = NULL;
245 SCSUINT16_COP *y = NULL;
246 u = Getint32InPortPtrs(block, 1);
247 y = Getuint16OutPortPtrs(block, 1);
248 k = pow(2, 16);
249 for (i = 0; i < m * n; i++)
250 {
251 v = (double)u[i];
252 w = v - (double)((int)(v / k)) * k;
253 y[i] = (SCSUINT16_COP)w;
254 }
255 break;
256 }
257 case 12:
258 {
259 SCSINT32_COP *u = NULL;
260 SCSUINT8_COP *y = NULL;
261 u = Getint32InPortPtrs(block, 1);
262 y = Getuint8OutPortPtrs(block, 1);
263 k = pow(2, 8);
264 for (i = 0; i < m * n; i++)
265 {
266 v = (double)u[i];
267 w = v - (double)((int)(v / k)) * k;
268 y[i] = (SCSUINT8_COP)w;
269 }
270 break;
271 }
272 case 13:
273 {
274 SCSINT16_COP *u = NULL;
275 double *y = NULL;
276 u = Getint16InPortPtrs(block, 1);
277 y = GetRealOutPortPtrs(block, 1);
278 for (i = 0; i < m * n; i++)
279 {
280 y[i] = (double) u[i];
281 }
282 break;
283 }
284 case 14:
285 {
286 SCSINT16_COP *u = NULL;
287 SCSINT32_COP *y = NULL;
288 u = Getint16InPortPtrs(block, 1);
289 y = Getint32OutPortPtrs(block, 1);
290 for (i = 0; i < m * n; i++)
291 {
292 y[i] = (SCSINT32_COP)u[i];
293 }
294 break;
295 }
296 case 15:
297 {
298 SCSINT16_COP *u = NULL;
299 SCSINT8_COP *y = NULL;
300 u = Getint16InPortPtrs(block, 1);
301 y = Getint8OutPortPtrs(block, 1);
302 k = pow(2, 8);
303 for (i = 0; i < m * n; i++)
304 {
305 v = (double)u[i];
306 w = v - (double)((int)(v / k)) * k;
307 if (fabs(w) > k / 2 - 1)
308 {
309 if (w >= 0)
310 {
311 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
312 }
313 else
314 {
315 w = -(-(k / 2) + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
316 }
317 }
318 y[i] = (SCSINT8_COP)w;
319 }
320 break;
321 }
322 case 16:
323 {
324 SCSINT16_COP *u = NULL;
325 SCSUINT32_COP *y = NULL;
326 u = Getint16InPortPtrs(block, 1);
327 y = Getuint32OutPortPtrs(block, 1);
328 for (i = 0; i < m * n; i++)
329 {
330 y[i] = (SCSUINT32_COP)u[i];
331 }
332 break;
333 }
334 case 17:
335 {
336 SCSINT16_COP *u = NULL;
337 SCSUINT8_COP *y = NULL;
338 u = Getint16InPortPtrs(block, 1);
339 y = Getuint8OutPortPtrs(block, 1);
340 k = pow(2, 8);
341 for (i = 0; i < m * n; i++)
342 {
343 v = (double)u[i];
344 w = v - (double)((int)(v / k)) * k;
345 y[i] = (SCSUINT8_COP)w;
346 }
347 break;
348 }
349 case 18:
350 {
351 SCSINT8_COP *u = NULL;
352 SCSREAL_COP *y = NULL;
353 u = Getint8InPortPtrs(block, 1);
354 y = GetRealOutPortPtrs(block, 1);
355 for (i = 0; i < m * n; i++)
356 {
357 y[i] = (SCSREAL_COP) u[i];
358 }
359 break;
360 }
361 case 19:
362 {
363 SCSINT8_COP *u = NULL;
364 SCSINT32_COP *y = NULL;
365 u = Getint8InPortPtrs(block, 1);
366 y = Getint32OutPortPtrs(block, 1);
367 for (i = 0; i < m * n; i++)
368 {
369 y[i] = (SCSINT32_COP)u[i];
370 }
371 break;
372 }
373 case 20:
374 {
375 SCSINT8_COP *u = NULL;
376 SCSINT16_COP *y = NULL;
377 u = Getint8InPortPtrs(block, 1);
378 y = Getint16OutPortPtrs(block, 1);
379 for (i = 0; i < m * n; i++)
380 {
381 y[i] = (SCSINT16_COP)u[i];
382 }
383 break;
384 }
385 case 21:
386 {
387 SCSINT8_COP *u = NULL;
388 SCSUINT32_COP *y = NULL;
389 u = Getint8InPortPtrs(block, 1);
390 y = Getuint32OutPortPtrs(block, 1);
391 for (i = 0; i < m * n; i++)
392 {
393 y[i] = (SCSUINT32_COP)u[i];
394 }
395 break;
396 }
397 case 22:
398 {
399 SCSINT8_COP *u = NULL;
400 SCSUINT16_COP *y = NULL;
401 u = Getint8InPortPtrs(block, 1);
402 y = Getuint16OutPortPtrs(block, 1);
403 for (i = 0; i < m * n; i++)
404 {
405 y[i] = (SCSUINT16_COP)u[i];
406 }
407 break;
408 }
409 case 23:
410 {
411 SCSUINT32_COP *u = NULL;
412 SCSREAL_COP *y = NULL;
413 u = Getuint32InPortPtrs(block, 1);
414 y = GetRealOutPortPtrs(block, 1);
415 for (i = 0; i < m * n; i++)
416 {
417 y[i] = (SCSREAL_COP) u[i];
418 }
419 break;
420 }
421 case 24:
422 {
423 SCSUINT32_COP *u = NULL;
424 SCSINT16_COP *y = NULL;
425 u = Getuint32InPortPtrs(block, 1);
426 y = Getint16OutPortPtrs(block, 1);
427 k = pow(2, 16);
428 for (i = 0; i < m * n; i++)
429 {
430 v = (double)u[i];
431 w = v - (double)((int)(v / k)) * k;
432 if ((w) > k / 2 - 1)
433 {
434 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
435 }
436 y[i] = (SCSINT16_COP)w;
437 }
438 break;
439 }
440 case 25:
441 {
442 SCSUINT32_COP *u = NULL;
443 SCSINT8_COP *y = NULL;
444 u = Getuint32InPortPtrs(block, 1);
445 y = Getint8OutPortPtrs(block, 1);
446 k = pow(2, 8);
447 for (i = 0; i < m * n; i++)
448 {
449 v = (double)u[i];
450 w = v - (double)((int)(v / k)) * k;
451 if ((w) > k / 2 - 1)
452 {
453 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
454 }
455 y[i] = (SCSINT8_COP)w;
456 }
457 break;
458 }
459 case 26:
460 {
461 SCSUINT32_COP *u = NULL;
462 SCSUINT16_COP *y = NULL;
463 u = Getuint32InPortPtrs(block, 1);
464 y = Getuint16OutPortPtrs(block, 1);
465 k = pow(2, 16);
466 for (i = 0; i < m * n; i++)
467 {
468 v = (double)u[i];
469 w = v - (double)((int)(v / k)) * k;
470 y[i] = (SCSUINT16_COP)w;
471 }
472 break;
473 }
474 case 27:
475 {
476 SCSUINT32_COP *u = NULL;
477 SCSUINT8_COP *y = NULL;
478 u = Getuint32InPortPtrs(block, 1);
479 y = Getuint8OutPortPtrs(block, 1);
480 k = pow(2, 8);
481 for (i = 0; i < m * n; i++)
482 {
483 v = (double)u[i];
484 w = v - (double)((int)(v / k)) * k;
485 y[i] = (SCSUINT8_COP)w;
486 }
487 break;
488 }
489 case 28:
490 {
491 SCSUINT16_COP *u = NULL;
492 SCSREAL_COP *y = NULL;
493 u = Getuint16InPortPtrs(block, 1);
494 y = GetRealOutPortPtrs(block, 1);
495 for (i = 0; i < m * n; i++)
496 {
497 y[i] = (SCSREAL_COP) u[i];
498 }
499 break;
500 }
501 case 29:
502 {
503 SCSUINT16_COP *u = NULL;
504 SCSINT32_COP *y = NULL;
505 u = Getuint16InPortPtrs(block, 1);
506 y = Getint32OutPortPtrs(block, 1);
507 for (i = 0; i < m * n; i++)
508 {
509 y[i] = (SCSINT32_COP)u[i];
510 }
511 break;
512 }
513 case 30:
514 {
515 SCSUINT16_COP *u = NULL;
516 SCSINT8_COP *y = NULL;
517 u = Getuint16InPortPtrs(block, 1);
518 y = Getint8OutPortPtrs(block, 1);
519 k = pow(2, 8);
520 for (i = 0; i < m * n; i++)
521 {
522 v = (double)u[i];
523 w = v - (double)((int)(v / k)) * k;
524 if (w > k / 2 - 1)
525 {
526 w = (-k / 2 + fabs(w - (double)((int)(w / (k / 2))) * (k / 2)));
527 }
528 y[i] = (SCSINT8_COP)w;
529 }
530 break;
531 }
532 case 31:
533 {
534 SCSUINT16_COP *u = NULL;
535 SCSUINT32_COP *y = NULL;
536 u = Getuint16InPortPtrs(block, 1);
537 y = Getuint32OutPortPtrs(block, 1);
538 for (i = 0; i < m * n; i++)
539 {
540 y[i] = (SCSUINT32_COP)u[i];
541 }
542 break;
543 }
544 case 32:
545 {
546 SCSUINT16_COP *u = NULL;
547 SCSUINT8_COP *y = NULL;
548 u = Getuint16InPortPtrs(block, 1);
549 y = Getuint8OutPortPtrs(block, 1);
550 k = pow(2, 8);
551 for (i = 0; i < m * n; i++)
552 {
553 v = (double)u[i];
554 w = v - (double)((int)(v / k)) * k;
555 y[i] = (SCSUINT8_COP)w;
556 }
557 break;
558 }
559 case 33:
560 {
561 SCSUINT8_COP *u = NULL;
562 SCSREAL_COP *y = NULL;
563 u = Getuint8InPortPtrs(block, 1);
564 y = GetRealOutPortPtrs(block, 1);
565 for (i = 0; i < m * n; i++)
566 {
567 y[i] = (SCSREAL_COP) u[i];
568 }
569 break;
570 }
571 case 34:
572 {
573 SCSUINT8_COP *u = NULL;
574 SCSINT32_COP *y = NULL;
575 u = Getuint8InPortPtrs(block, 1);
576 y = Getint32OutPortPtrs(block, 1);
577 for (i = 0; i < m * n; i++)
578 {
579 y[i] = (SCSINT32_COP)u[i];
580 }
581 break;
582 }
583 case 35:
584 {
585 SCSUINT8_COP *u = NULL;
586 SCSINT16_COP *y = NULL;
587 u = Getuint8InPortPtrs(block, 1);
588 y = Getint16OutPortPtrs(block, 1);
589 for (i = 0; i < m * n; i++)
590 {
591 y[i] = (SCSINT16_COP)u[i];
592 }
593 break;
594 }
595 case 36:
596 {
597 SCSUINT8_COP *u = NULL;
598 SCSUINT32_COP *y = NULL;
599 u = Getuint8InPortPtrs(block, 1);
600 y = Getuint32OutPortPtrs(block, 1);
601 for (i = 0; i < m * n; i++)
602 {
603 y[i] = (SCSUINT32_COP)u[i];
604 }
605 break;
606 }
607 case 37:
608 {
609 SCSUINT8_COP *u = NULL;
610 SCSUINT16_COP *y = NULL;
611 u = Getuint8InPortPtrs(block, 1);
612 y = Getuint16OutPortPtrs(block, 1);
613 for (i = 0; i < m * n; i++)
614 {
615 y[i] = (SCSUINT16_COP)u[i];
616 }
617 break;
618 }
619 case 38:
620 {
621 SCSREAL_COP *u = NULL;
622 SCSINT32_COP *y = NULL;
623 u = GetRealInPortPtrs(block, 1);
624 y = Getint32OutPortPtrs(block, 1);
625 k = pow(2, 32);
626 for (i = 0; i < m * n; i++)
627 {
628 if (u[i] > k / 2 - 1)
629 {
630 y[i] = (SCSINT32_COP)(k / 2 - 1);
631 }
632 else if (u[i] < -(k / 2))
633 {
634 y[i] = -(SCSINT32_COP)(k / 2);
635 }
636 else
637 {
638 y[i] = (SCSINT32_COP)(u[i]);
639 }
640 }
641 break;
642 }
643 case 39:
644 {
645 SCSREAL_COP *u = NULL;
646 SCSINT16_COP *y = NULL;
647 u = GetRealInPortPtrs(block, 1);
648 y = Getint16OutPortPtrs(block, 1);
649 k = pow(2, 16);
650 for (i = 0; i < m * n; i++)
651 {
652 if (u[i] > k / 2 - 1)
653 {
654 y[i] = (SCSINT16_COP)(k / 2 - 1);
655 }
656 else if (u[i] < -(k / 2))
657 {
658 y[i] = -(SCSINT16_COP)(k / 2);
659 }
660 else
661 {
662 y[i] = (SCSINT16_COP)(u[i]);
663 }
664 }
665 break;
666 }
667 case 40:
668 {
669 SCSREAL_COP *u = NULL;
670 SCSINT8_COP *y = NULL;
671 u = GetRealInPortPtrs(block, 1);
672 y = Getint8OutPortPtrs(block, 1);
673 k = pow(2, 8);
674 for (i = 0; i < m * n; i++)
675 {
676 if (u[i] > k / 2 - 1)
677 {
678 y[i] = (SCSINT8_COP)(k / 2 - 1);
679 }
680 else if (u[i] < -(k / 2))
681 {
682 y[i] = -(SCSINT8_COP)(k / 2);
683 }
684 else
685 {
686 y[i] = (SCSINT8_COP)(u[i]);
687 }
688 }
689 break;
690 }
691 case 41:
692 {
693 SCSREAL_COP *u = NULL;
694 SCSUINT32_COP *y = NULL;
695 u = GetRealInPortPtrs(block, 1);
696 y = Getuint32OutPortPtrs(block, 1);
697 k = pow(2, 32);
698 for (i = 0; i < m * n; i++)
699 {
700 if (u[i] >= k)
701 {
702 y[i] = (SCSUINT32_COP)(k - 1);
703 }
704 else if (u[i] < 0)
705 {
706 y[i] = 0;
707 }
708 else
709 {
710 y[i] = (SCSUINT32_COP)(u[i]);
711 }
712 }
713 break;
714 }
715 case 42:
716 {
717 SCSREAL_COP *u = NULL;
718 SCSUINT16_COP *y = NULL;
719 u = GetRealInPortPtrs(block, 1);
720 y = Getuint16OutPortPtrs(block, 1);
721 k = pow(2, 16);
722 for (i = 0; i < m * n; i++)
723 {
724 if (u[i] >= k)
725 {
726 y[i] = (SCSUINT16_COP)(k - 1);
727 }
728 else if (u[i] < 0)
729 {
730 y[i] = 0;
731 }
732 else
733 {
734 y[i] = (SCSUINT16_COP)(u[i]);
735 }
736 }
737 break;
738 }
739 case 43:
740 {
741 SCSREAL_COP *u = NULL;
742 SCSUINT8_COP *y = NULL;
743 u = GetRealInPortPtrs(block, 1);
744 y = Getuint8OutPortPtrs(block, 1);
745 k = pow(2, 8);
746 for (i = 0; i < m * n; i++)
747 {
748 if (u[i] >= k)
749 {
750 y[i] = (SCSUINT8_COP)(k - 1);
751 }
752 else if (u[i] < 0)
753 {
754 y[i] = 0;
755 }
756 else
757 {
758 y[i] = (SCSUINT8_COP)(u[i]);
759 }
760 }
761 break;
762 }
763 case 44:
764 {
765 SCSINT32_COP *u = NULL;
766 SCSINT16_COP *y = NULL;
767 u = Getint32InPortPtrs(block, 1);
768 y = Getint16OutPortPtrs(block, 1);
769 k = pow(2, 16);
770 for (i = 0; i < m * n; i++)
771 {
772 if (u[i] > (SCSINT32_COP)(k / 2 - 1))
773 {
774 y[i] = (SCSINT16_COP)(k / 2 - 1);
775 }
776 else if (u[i] < -(SCSINT32_COP)(k / 2))
777 {
778 y[i] = -(SCSINT16_COP)(k / 2);
779 }
780 else
781 {
782 y[i] = (SCSINT16_COP)(u[i]);
783 }
784 }
785 break;
786 }
787 case 45:
788 {
789 SCSINT32_COP *u = NULL;
790 SCSINT8_COP *y = NULL;
791 u = Getint32InPortPtrs(block, 1);
792 y = Getint8OutPortPtrs(block, 1);
793 k = pow(2, 8);
794 for (i = 0; i < m * n; i++)
795 {
796 if (u[i] > (SCSINT32_COP)(k / 2 - 1))
797 {
798 y[i] = (SCSINT8_COP)(k / 2 - 1);
799 }
800 else if (u[i] < -(SCSINT32_COP)(k / 2))
801 {
802 y[i] = -(SCSINT8_COP)(k / 2);
803 }
804 else
805 {
806 y[i] = (SCSINT8_COP)(u[i]);
807 }
808 }
809 break;
810 }
811 case 46:
812 {
813 SCSINT32_COP *u = NULL;
814 SCSUINT32_COP *y = NULL;
815 u = Getint32InPortPtrs(block, 1);
816 y = Getuint32OutPortPtrs(block, 1);
817 for (i = 0; i < m * n; i++)
818 {
819 if (u[i] < 0)
820 {
821 y[i] = 0;
822 }
823 else
824 {
825 y[i] = (SCSUINT32_COP)(u[i]);
826 }
827 }
828 break;
829 }
830 case 47:
831 {
832 SCSINT32_COP *u = NULL;
833 SCSUINT16_COP *y = NULL;
834 u = Getint32InPortPtrs(block, 1);
835 y = Getuint16OutPortPtrs(block, 1);
836 k = pow(2, 16);
837 for (i = 0; i < m * n; i++)
838 {
839 if (u[i] >= (SCSINT32_COP)(k))
840 {
841 y[i] = (SCSUINT16_COP)(k - 1);
842 }
843 else if (u[i] < 0)
844 {
845 y[i] = 0;
846 }
847 else
848 {
849 y[i] = (SCSUINT16_COP)(u[i]);
850 }
851 }
852 break;
853 }
854 case 48:
855 {
856 SCSINT32_COP *u = NULL;
857 SCSUINT8_COP *y = NULL;
858 u = Getint32InPortPtrs(block, 1);
859 y = Getuint8OutPortPtrs(block, 1);
860 k = pow(2, 8);
861 for (i = 0; i < m * n; i++)
862 {
863 if (u[i] >= (SCSINT32_COP)k)
864 {
865 y[i] = (SCSUINT8_COP)(k - 1);
866 }
867 else if (u[i] < 0)
868 {
869 y[i] = 0;
870 }
871 else
872 {
873 y[i] = (SCSUINT8_COP)(u[i]);
874 }
875 }
876 break;
877 }
878 case 49:
879 {
880 SCSINT16_COP *u = NULL;
881 SCSINT8_COP *y = NULL;
882 u = Getint16InPortPtrs(block, 1);
883 y = Getint8OutPortPtrs(block, 1);
884 k = pow(2, 8);
885 for (i = 0; i < m * n; i++)
886 {
887 if (u[i] > (SCSINT16_COP)(k / 2 - 1))
888 {
889 y[i] = (SCSINT8_COP)(k / 2 - 1);
890 }
891 else if (u[i] < -(SCSINT16_COP)(k / 2))
892 {
893 y[i] = -(SCSINT8_COP)(k / 2);
894 }
895 else
896 {
897 y[i] = (SCSINT8_COP)(u[i]);
898 }
899 }
900 break;
901 }
902 case 50:
903 {
904 SCSINT16_COP *u = NULL;
905 SCSUINT32_COP *y = NULL;
906 u = Getint16InPortPtrs(block, 1);
907 y = Getuint32OutPortPtrs(block, 1);
908 for (i = 0; i < m * n; i++)
909 {
910 if (u[i] < 0)
911 {
912 y[i] = 0;
913 }
914 else
915 {
916 y[i] = (SCSUINT32_COP)u[i];
917 }
918 }
919 break;
920 }
921 case 51:
922 {
923 SCSINT16_COP *u = NULL;
924 SCSUINT16_COP *y = NULL;
925 u = Getint16InPortPtrs(block, 1);
926 y = Getuint16OutPortPtrs(block, 1);
927 for (i = 0; i < m * n; i++)
928 {
929 if (u[i] < 0)
930 {
931 y[i] = 0;
932 }
933 else
934 {
935 y[i] = (SCSUINT16_COP)(u[i]);
936 }
937 }
938 break;
939 }
940 case 52:
941 {
942 SCSINT16_COP *u = NULL;
943 SCSUINT8_COP *y = NULL;
944 u = Getint16InPortPtrs(block, 1);
945 y = Getuint8OutPortPtrs(block, 1);
946 k = pow(2, 8);
947 for (i = 0; i < m * n; i++)
948 {
949 if (u[i] >= (SCSINT16_COP)k)
950 {
951 y[i] = (SCSUINT8_COP)(k - 1);
952 }
953 else if (u[i] < 0)
954 {
955 y[i] = 0;
956 }
957 else
958 {
959 y[i] = (SCSUINT8_COP)(u[i]);
960 }
961 }
962 break;
963 }
964 case 53:
965 {
966 SCSINT8_COP *u = NULL;
967 SCSUINT32_COP *y = NULL;
968 u = Getint8InPortPtrs(block, 1);
969 y = Getuint32OutPortPtrs(block, 1);
970 for (i = 0; i < m * n; i++)
971 {
972 if (u[i] < 0)
973 {
974 y[i] = 0;
975 }
976 else
977 {
978 y[i] = (SCSUINT32_COP)u[i];
979 }
980 }
981 break;
982 }
983 case 54:
984 {
985 SCSINT8_COP *u = NULL;
986 SCSUINT16_COP *y = NULL;
987 u = Getint8InPortPtrs(block, 1);
988 y = Getuint16OutPortPtrs(block, 1);
989 for (i = 0; i < m * n; i++)
990 {
991 if (u[i] < 0)
992 {
993 y[i] = 0;
994 }
995 else
996 {
997 y[i] = (SCSUINT16_COP)(u[i]);
998 }
999 }
1000 break;
1001 }
1002 case 55:
1003 {
1004 SCSINT8_COP *u = NULL;
1005 SCSUINT8_COP *y = NULL;
1006 u = Getint8InPortPtrs(block, 1);
1007 y = Getuint8OutPortPtrs(block, 1);
1008 for (i = 0; i < m * n; i++)
1009 {
1010 if (u[i] < 0)
1011 {
1012 y[i] = 0;
1013 }
1014 else
1015 {
1016 y[i] = (SCSUINT8_COP)(u[i]);
1017 }
1018 }
1019 break;
1020 }
1021 case 56:
1022 {
1023 SCSINT32_COP *y = NULL;
1024 SCSUINT32_COP *u = NULL;
1025 u = Getuint32InPortPtrs(block, 1);
1026 y = Getint32OutPortPtrs(block, 1);
1027 k = pow(2, 32);
1028 for (i = 0; i < m * n; i++)
1029 {
1030 if (u[i] > (SCSUINT32_COP)(k / 2 - 1))
1031 {
1032 y[i] = (SCSINT32_COP)(k / 2 - 1);
1033 }
1034 else
1035 {
1036 y[i] = (SCSINT32_COP)(u[i]);
1037 }
1038 }
1039 break;
1040 }
1041 case 57:
1042 {
1043 SCSUINT32_COP *u = NULL;
1044 SCSINT16_COP *y = NULL;
1045 u = Getuint32InPortPtrs(block, 1);
1046 y = Getint16OutPortPtrs(block, 1);
1047 k = pow(2, 16);
1048 for (i = 0; i < m * n; i++)
1049 {
1050 if (u[i] > (SCSUINT32_COP)(k / 2 - 1))
1051 {
1052 y[i] = (SCSINT16_COP)(k / 2 - 1);
1053 }
1054 else
1055 {
1056 y[i] = (SCSINT16_COP)(u[i]);
1057 }
1058 }
1059 break;
1060 }
1061 case 58:
1062 {
1063 SCSUINT32_COP *u = NULL;
1064 SCSINT8_COP *y = NULL;
1065 u = Getuint32InPortPtrs(block, 1);
1066 y = Getint8OutPortPtrs(block, 1);
1067 k = pow(2, 8);
1068 for (i = 0; i < m * n; i++)
1069 {
1070 if (u[i] > (SCSUINT32_COP)(k / 2 - 1))
1071 {
1072 y[i] = (SCSINT8_COP)(k / 2 - 1);
1073 }
1074 else
1075 {
1076 y[i] = (SCSINT8_COP)(u[i]);
1077 }
1078 }
1079 break;
1080 }
1081 case 59:
1082 {
1083 SCSUINT32_COP *u = NULL;
1084 SCSUINT16_COP *y = NULL;
1085 u = Getuint32InPortPtrs(block, 1);
1086 y = Getuint16OutPortPtrs(block, 1);
1087 k = pow(2, 16);
1088 for (i = 0; i < m * n; i++)
1089 {
1090 if (u[i] > (SCSUINT32_COP)(k / 2 - 1))
1091 {
1092 y[i] = (SCSUINT16_COP)(k / 2 - 1);
1093 }
1094 else
1095 {
1096 y[i] = (SCSUINT16_COP)(u[i]);
1097 }
1098 }
1099 break;
1100 }
1101 case 60:
1102 {
1103 SCSUINT32_COP *u = NULL;
1104 SCSUINT8_COP *y = NULL;
1105 u = Getuint32InPortPtrs(block, 1);
1106 y = Getuint8OutPortPtrs(block, 1);
1107 k = pow(2, 8);
1108 for (i = 0; i < m * n; i++)
1109 {
1110 if (u[i] > (SCSUINT32_COP)(k / 2 - 1))
1111 {
1112 y[i] = (SCSUINT8_COP)(k / 2 - 1);
1113 }
1114 else
1115 {
1116 y[i] = (SCSUINT8_COP)(u[i]);
1117 }
1118 }
1119 break;
1120 }
1121 case 61:
1122 {
1123 SCSUINT16_COP *u = NULL;
1124 SCSINT16_COP *y = NULL;
1125 u = Getuint16InPortPtrs(block, 1);
1126 y = Getint16OutPortPtrs(block, 1);
1127 k = pow(2, 16);
1128 for (i = 0; i < m * n; i++)
1129 {
1130 if (u[i] > (SCSUINT16_COP)(k / 2 - 1))
1131 {
1132 y[i] = (SCSINT16_COP)(k / 2 - 1);
1133 }
1134 else
1135 {
1136 y[i] = (SCSINT16_COP)(u[i]);
1137 }
1138 }
1139 break;
1140 }
1141 case 62:
1142 {
1143 SCSUINT16_COP *u = NULL;
1144 SCSINT8_COP *y = NULL;
1145 u = Getuint16InPortPtrs(block, 1);
1146 y = Getint8OutPortPtrs(block, 1);
1147 k = pow(2, 8);
1148 for (i = 0; i < m * n; i++)
1149 {
1150 if (u[i] > (SCSUINT16_COP)(k / 2 - 1))
1151 {
1152 y[i] = (SCSINT8_COP)(k / 2 - 1);
1153 }
1154 else
1155 {
1156 y[i] = (SCSINT8_COP)(u[i]);
1157 }
1158 }
1159 break;
1160 }
1161 case 63:
1162 {
1163 SCSUINT16_COP *u = NULL;
1164 SCSUINT8_COP *y = NULL;
1165 u = Getuint16InPortPtrs(block, 1);
1166 y = Getuint8OutPortPtrs(block, 1);
1167 k = pow(2, 8);
1168 for (i = 0; i < m * n; i++)
1169 {
1170 if (u[i] > (SCSUINT16_COP)(k / 2 - 1))
1171 {
1172 y[i] = (SCSUINT8_COP)k / 2 - 1;
1173 }
1174 else
1175 {
1176 y[i] = (SCSUINT8_COP)(u[i]);
1177 }
1178 }
1179 break;
1180 }
1181 case 64:
1182 {
1183 SCSUINT8_COP *u = NULL;
1184 SCSINT8_COP *y = NULL;
1185 u = Getuint8InPortPtrs(block, 1);
1186 y = Getint8OutPortPtrs(block, 1);
1187 k = pow(2, 8);
1188 for (i = 0; i < m * n; i++)
1189 {
1190 if (u[i] > (SCSUINT8_COP)(k / 2 - 1))
1191 {
1192 y[i] = (SCSINT8_COP)(k / 2 - 1);
1193 }
1194 else
1195 {
1196 y[i] = (SCSINT8_COP)(u[i]);
1197 }
1198 }
1199 break;
1200 }
1201 case 65:
1202 {
1203 SCSREAL_COP *u = NULL;
1204 SCSINT32_COP *y = NULL;
1205 u = GetRealInPortPtrs(block, 1);
1206 y = Getint32OutPortPtrs(block, 1);
1207 k = pow(2, 32);
1208 for (i = 0; i < m * n; i++)
1209 {
1210 if ((u[i] > k / 2 - 1) | (u[i] < -(k / 2)))
1211 {
1212 if (flag == 1)
1213 {
1214 scicos_print(_("overflow error"));
1215 set_block_error(-4);
1216 return;
1217 }
1218 }
1219 else
1220 {
1221 y[i] = (SCSINT32_COP)(u[i]);
1222 }
1223 }
1224 break;
1225 }
1226 case 66:
1227 {
1228 SCSREAL_COP *u = NULL;
1229 SCSINT16_COP *y = NULL;
1230 u = GetRealInPortPtrs(block, 1);
1231 y = Getint16OutPortPtrs(block, 1);
1232 k = pow(2, 16);
1233 for (i = 0; i < m * n; i++)
1234 {
1235 if ((u[i] > k / 2 - 1) | (u[i] < -(k / 2)))
1236 {
1237 if (flag == 1)
1238 {
1239 scicos_print(_("overflow error"));
1240 set_block_error(-4);
1241 return;
1242 }
1243 }
1244 else
1245 {
1246 y[i] = (SCSINT16_COP)(u[i]);
1247 }
1248 }
1249 break;
1250 }
1251 case 67:
1252 {
1253 SCSREAL_COP *u = NULL;
1254 SCSINT8_COP *y = NULL;
1255 u = GetRealInPortPtrs(block, 1);
1256 y = Getint8OutPortPtrs(block, 1);
1257 k = pow(2, 8);
1258 for (i = 0; i < m * n; i++)
1259 {
1260 if ((u[i] > k / 2 - 1) | (u[i] < -(k / 2)))
1261 {
1262 if (flag == 1)
1263 {
1264 scicos_print(_("overflow error"));
1265 set_block_error(-4);
1266 return;
1267 }
1268 }
1269 else
1270 {
1271 y[i] = (SCSINT8_COP)(u[i]);
1272 }
1273 }
1274 break;
1275 }
1276 case 68:
1277 {
1278 SCSREAL_COP *u = NULL;
1279 SCSUINT32_COP *y = NULL;
1280 u = GetRealInPortPtrs(block, 1);
1281 y = Getuint32OutPortPtrs(block, 1);
1282 k = pow(2, 32);
1283 for (i = 0; i < m * n; i++)
1284 {
1285 if ((u[i] >= k) | (u[i] < 0))
1286 {
1287 if (flag == 1)
1288 {
1289 scicos_print(_("overflow error"));
1290 set_block_error(-4);
1291 return;
1292 }
1293 }
1294 else
1295 {
1296 y[i] = (SCSUINT32_COP)(u[i]);
1297 }
1298 }
1299 break;
1300 }
1301 case 69:
1302 {
1303 SCSREAL_COP *u = NULL;
1304 SCSUINT16_COP *y = NULL;
1305 u = GetRealInPortPtrs(block, 1);
1306 y = Getuint16OutPortPtrs(block, 1);
1307 k = pow(2, 16);
1308 for (i = 0; i < m * n; i++)
1309 {
1310 if ((u[i] >= k) | (u[i] < 0))
1311 {
1312 if (flag == 1)
1313 {
1314 scicos_print(_("overflow error"));
1315 set_block_error(-4);
1316 return;
1317 }
1318 }
1319 else
1320 {
1321 y[i] = (SCSUINT16_COP)(u[i]);
1322 }
1323 }
1324 break;
1325 }
1326 case 70:
1327 {
1328 SCSREAL_COP *u = NULL;
1329 SCSUINT8_COP *y = NULL;
1330 u = GetRealInPortPtrs(block, 1);
1331 y = Getuint8OutPortPtrs(block, 1);
1332 k = pow(2, 8);
1333 for (i = 0; i < m * n; i++)
1334 {
1335 if ((u[i] >= k) | (u[i] < 0))
1336 {
1337 if (flag == 1)
1338 {
1339 scicos_print(_("overflow error"));
1340 set_block_error(-4);
1341 return;
1342 }
1343 }
1344 else
1345 {
1346 y[i] = (SCSUINT8_COP)(u[i]);
1347 }
1348 }
1349 break;
1350 }
1351 case 71:
1352 {
1353 SCSINT32_COP *u = NULL;
1354 SCSINT16_COP *y = NULL;
1355 u = Getint32InPortPtrs(block, 1);
1356 y = Getint16OutPortPtrs(block, 1);
1357 k = pow(2, 16);
1358 for (i = 0; i < m * n; i++)
1359 {
1360 if ((u[i] > k / 2 - 1) | (u[i] < -(k / 2)))
1361 {
1362 if (flag == 1)
1363 {
1364 scicos_print(_("overflow error"));
1365 set_block_error(-4);
1366 return;
1367 }
1368 }
1369 else
1370 {
1371 y[i] = (SCSINT16_COP)(u[i]);
1372 }
1373 }
1374 break;
1375 }
1376 case 72:
1377 {
1378 SCSINT32_COP *u = NULL;
1379 SCSINT8_COP *y = NULL;
1380 u = Getint32InPortPtrs(block, 1);
1381 y = Getint8OutPortPtrs(block, 1);
1382 k = pow(2, 8);
1383 for (i = 0; i < m * n; i++)
1384 {
1385 if ((u[i] > k / 2 - 1) | (u[i] < -(k / 2)))
1386 {
1387 if (flag == 1)
1388 {
1389 scicos_print(_("overflow error"));
1390 set_block_error(-4);
1391 return;
1392 }
1393 }
1394 else
1395 {
1396 y[i] = (SCSINT8_COP)(u[i]);
1397 }
1398 }
1399 break;
1400 }
1401 case 73:
1402 {
1403 SCSINT32_COP *u = NULL;
1404 SCSUINT32_COP *y = NULL;
1405 u = Getint32InPortPtrs(block, 1);
1406 y = Getuint32OutPortPtrs(block, 1);
1407 for (i = 0; i < m * n; i++)
1408 {
1409 if (u[i] < 0)
1410 {
1411 if (flag == 1)
1412 {
1413 scicos_print(_("overflow error"));
1414 set_block_error(-4);
1415 return;
1416 }
1417 }
1418 else
1419 {
1420 y[i] = (SCSUINT32_COP)(u[i]);
1421 }
1422 }
1423 break;
1424 }
1425 case 74:
1426 {
1427 SCSINT32_COP *u = NULL;
1428 SCSUINT16_COP *y = NULL;
1429 u = Getint32InPortPtrs(block, 1);
1430 y = Getuint16OutPortPtrs(block, 1);
1431 k = pow(2, 16);
1432 for (i = 0; i < m * n; i++)
1433 {
1434 if ((u[i] >= k) | (u[i] < 0))
1435 {
1436 if (flag == 1)
1437 {
1438 scicos_print(_("overflow error"));
1439 set_block_error(-4);
1440 return;
1441 }
1442 }
1443 else
1444 {
1445 y[i] = (SCSUINT16_COP)(u[i]);
1446 }
1447 }
1448 break;
1449 }
1450 case 75:
1451 {
1452 SCSINT32_COP *u = NULL;
1453 SCSUINT8_COP *y = NULL;
1454 u = Getint32InPortPtrs(block, 1);
1455 y = Getuint8OutPortPtrs(block, 1);
1456 k = pow(2, 8);
1457 for (i = 0; i < m * n; i++)
1458 {
1459 if ((u[i] >= k) | (u[i] < 0))
1460 {
1461 if (flag == 1)
1462 {
1463 scicos_print(_("overflow error"));
1464 set_block_error(-4);
1465 return;
1466 }
1467 }
1468 else
1469 {
1470 y[i] = (SCSUINT8_COP)(u[i]);
1471 }
1472 }
1473 break;
1474 }
1475 case 76:
1476 {
1477 SCSINT16_COP *u = NULL;
1478 SCSINT8_COP *y = NULL;
1479 u = Getint16InPortPtrs(block, 1);
1480 y = Getint8OutPortPtrs(block, 1);
1481 k = pow(2, 8);
1482 for (i = 0; i < m * n; i++)
1483 {
1484 if ((u[i] > k / 2 - 1) | (u[i] < -(k / 2)))
1485 {
1486 if (flag == 1)
1487 {
1488 scicos_print(_("overflow error"));
1489 set_block_error(-4);
1490 return;
1491 }
1492 }
1493 else
1494 {
1495 y[i] = (SCSINT8_COP)(u[i]);
1496 }
1497 }
1498 break;
1499 }
1500 case 77:
1501 {
1502 SCSINT16_COP *u = NULL;
1503 SCSUINT32_COP *y = NULL;
1504 u = Getint16InPortPtrs(block, 1);
1505 y = Getuint32OutPortPtrs(block, 1);
1506 for (i = 0; i < m * n; i++)
1507 {
1508 if (u[i] < 0)
1509 {
1510 if (flag == 1)
1511 {
1512 scicos_print(_("overflow error"));
1513 set_block_error(-4);
1514 return;
1515 }
1516 }
1517 else
1518 {
1519 y[i] = (SCSUINT32_COP)u[i];
1520 }
1521 }
1522 break;
1523 }
1524 case 78:
1525 {
1526 SCSINT16_COP *u = NULL;
1527 SCSUINT16_COP *y = NULL;
1528 u = Getint16InPortPtrs(block, 1);
1529 y = Getuint16OutPortPtrs(block, 1);
1530 for (i = 0; i < m * n; i++)
1531 {
1532 if (u[i] < 0)
1533 {
1534 if (flag == 1)
1535 {
1536 scicos_print(_("overflow error"));
1537 set_block_error(-4);
1538 return;
1539 }
1540 }
1541 else
1542 {
1543 y[i] = (SCSUINT16_COP)(u[i]);
1544 }
1545 }
1546 break;
1547 }
1548 case 79:
1549 {
1550 SCSINT16_COP *u = NULL;
1551 SCSUINT8_COP *y = NULL;
1552 u = Getint16InPortPtrs(block, 1);
1553 y = Getuint8OutPortPtrs(block, 1);
1554 k = pow(2, 8);
1555 for (i = 0; i < m * n; i++)
1556 {
1557 if (((u[i] >= k) | (u[i] < 0)) & (flag == 1))
1558 {
1559 if (flag == 1)
1560 {
1561 scicos_print(_("overflow error"));
1562 set_block_error(-4);
1563 return;
1564 }
1565 }
1566 else
1567 {
1568 y[i] = (SCSUINT8_COP)(u[i]);
1569 }
1570 }
1571 break;
1572 }
1573 case 80:
1574 {
1575 SCSINT8_COP *u = NULL;
1576 SCSUINT32_COP *y = NULL;
1577 u = Getint8InPortPtrs(block, 1);
1578 y = Getuint32OutPortPtrs(block, 1);
1579 for (i = 0; i < m * n; i++)
1580 {
1581 if (u[i] < 0)
1582 {
1583 if (flag == 1)
1584 {
1585 scicos_print(_("overflow error"));
1586 set_block_error(-4);
1587 return;
1588 }
1589 }
1590 else
1591 {
1592 y[i] = (SCSUINT32_COP)u[i];
1593 }
1594 }
1595 break;
1596 }
1597 case 81:
1598 {
1599 SCSINT8_COP *u = NULL;
1600 SCSUINT16_COP *y = NULL;
1601 u = Getint8InPortPtrs(block, 1);
1602 y = Getuint16OutPortPtrs(block, 1);
1603 for (i = 0; i < m * n; i++)
1604 {
1605 if (u[i] < 0)
1606 {
1607 if (flag == 1)
1608 {
1609 scicos_print(_("overflow error"));
1610 set_block_error(-4);
1611 return;
1612 }
1613 }
1614 else
1615 {
1616 y[i] = (SCSUINT16_COP)(u[i]);
1617 }
1618 }
1619 break;
1620 }
1621 case 82:
1622 {
1623 SCSINT8_COP *u = NULL;
1624 SCSUINT8_COP *y = NULL;
1625 u = Getint8InPortPtrs(block, 1);
1626 y = Getuint8OutPortPtrs(block, 1);
1627 for (i = 0; i < m * n; i++)
1628 {
1629 if (u[i] < 0)
1630 {
1631 if (flag == 1)
1632 {
1633 scicos_print(_("overflow error"));
1634 set_block_error(-4);
1635 return;
1636 }
1637 }
1638 else
1639 {
1640 y[i] = (SCSUINT8_COP)(u[i]);
1641 }
1642 }
1643 break;
1644 }
1645 case 83:
1646 {
1647 SCSINT32_COP *y = NULL;
1648 SCSUINT32_COP *u = NULL;
1649 u = Getuint32InPortPtrs(block, 1);
1650 y = Getint32OutPortPtrs(block, 1);
1651 k = pow(2, 32);
1652 for (i = 0; i < m * n; i++)
1653 {
1654 if (u[i] > (k / 2 - 1))
1655 {
1656 if (flag == 1)
1657 {
1658 scicos_print(_("overflow error"));
1659 set_block_error(-4);
1660 return;
1661 }
1662 }
1663 else
1664 {
1665 y[i] = (SCSINT32_COP)(u[i]);
1666 }
1667 }
1668 break;
1669 }
1670 case 84:
1671 {
1672 SCSUINT32_COP *u = NULL;
1673 SCSINT16_COP *y = NULL;
1674 u = Getuint32InPortPtrs(block, 1);
1675 y = Getint16OutPortPtrs(block, 1);
1676 k = pow(2, 16);
1677 for (i = 0; i < m * n; i++)
1678 {
1679 if (u[i] > (k / 2 - 1))
1680 {
1681 if (flag == 1)
1682 {
1683 scicos_print(_("overflow error"));
1684 set_block_error(-4);
1685 return;
1686 }
1687 }
1688 else
1689 {
1690 y[i] = (SCSINT16_COP)(u[i]);
1691 }
1692 }
1693 break;
1694 }
1695 case 85:
1696 {
1697 SCSUINT32_COP *u = NULL;
1698 SCSINT8_COP *y = NULL;
1699 u = Getuint32InPortPtrs(block, 1);
1700 y = Getint8OutPortPtrs(block, 1);
1701 k = pow(2, 8);
1702 for (i = 0; i < m * n; i++)
1703 {
1704 if (u[i] > (k / 2 - 1))
1705 {
1706 if (flag == 1)
1707 {
1708 scicos_print(_("overflow error"));
1709 set_block_error(-4);
1710 return;
1711 }
1712 }
1713 else
1714 {
1715 y[i] = (SCSINT8_COP)(u[i]);
1716 }
1717 }
1718 break;
1719 }
1720 case 86:
1721 {
1722 SCSUINT32_COP *u = NULL;
1723 SCSUINT16_COP *y = NULL;
1724 u = Getuint32InPortPtrs(block, 1);
1725 y = Getuint16OutPortPtrs(block, 1);
1726 k = pow(2, 16);
1727 for (i = 0; i < m * n; i++)
1728 {
1729 if (u[i] > (k / 2 - 1))
1730 {
1731 if (flag == 1)
1732 {
1733 scicos_print(_("overflow error"));
1734 set_block_error(-4);
1735 return;
1736 }
1737 }
1738 else
1739 {
1740 y[i] = (SCSUINT16_COP)(u[i]);
1741 }
1742 }
1743 break;
1744 }
1745 case 87:
1746 {
1747 SCSUINT32_COP *u = NULL;
1748 SCSUINT8_COP *y = NULL;
1749 u = Getuint32InPortPtrs(block, 1);
1750 y = Getuint8OutPortPtrs(block, 1);
1751 k = pow(2, 8);
1752 for (i = 0; i < m * n; i++)
1753 {
1754 if (u[i] > (k / 2 - 1))
1755 {
1756 if (flag == 1)
1757 {
1758 scicos_print(_("overflow error"));
1759 set_block_error(-4);
1760 return;
1761 }
1762 }
1763 else
1764 {
1765 y[i] = (SCSUINT8_COP)(u[i]);
1766 }
1767 }
1768 break;
1769 }
1770 case 88:
1771 {
1772 SCSUINT16_COP *u = NULL;
1773 SCSINT16_COP *y = NULL;
1774 u = Getuint16InPortPtrs(block, 1);
1775 y = Getint16OutPortPtrs(block, 1);
1776 k = pow(2, 16);
1777 for (i = 0; i < m * n; i++)
1778 {
1779 if (u[i] > (k / 2 - 1))
1780 {
1781 if (flag == 1)
1782 {
1783 scicos_print(_("overflow error"));
1784 set_block_error(-4);
1785 return;
1786 }
1787 }
1788 else
1789 {
1790 y[i] = (SCSINT16_COP)(u[i]);
1791 }
1792 }
1793 break;
1794 }
1795 case 89:
1796 {
1797 SCSUINT16_COP *u = NULL;
1798 SCSINT8_COP *y = NULL;
1799 u = Getuint16InPortPtrs(block, 1);
1800 y = Getint8OutPortPtrs(block, 1);
1801 k = pow(2, 8);
1802 for (i = 0; i < m * n; i++)
1803 {
1804 if (u[i] > (k / 2 - 1))
1805 {
1806 if (flag == 1)
1807 {
1808 scicos_print(_("overflow error"));
1809 set_block_error(-4);
1810 return;
1811 }
1812 }
1813 else
1814 {
1815 y[i] = (SCSINT8_COP)(u[i]);
1816 }
1817 }
1818 break;
1819 }
1820 case 90:
1821 {
1822 SCSUINT16_COP *u = NULL;
1823 SCSUINT8_COP *y = NULL;
1824 u = Getuint16InPortPtrs(block, 1);
1825 y = Getuint8OutPortPtrs(block, 1);
1826 k = pow(2, 8);
1827 for (i = 0; i < m * n; i++)
1828 {
1829 if (u[i] > (k / 2 - 1))
1830 {
1831 if (flag == 1)
1832 {
1833 scicos_print(_("overflow error"));
1834 set_block_error(-4);
1835 return;
1836 }
1837 }
1838 else
1839 {
1840 y[i] = (SCSUINT8_COP)(u[i]);
1841 }
1842 }
1843 break;
1844 }
1845 case 91:
1846 {
1847 SCSUINT8_COP *u = NULL;
1848 SCSINT8_COP *y = NULL;
1849 u = Getuint8InPortPtrs(block, 1);
1850 y = Getint8OutPortPtrs(block, 1);
1851 k = pow(2, 8);
1852 for (i = 0; i < m * n; i++)
1853 {
1854 if (u[i] > (k / 2 - 1))
1855 {
1856 if (flag == 1)
1857 {
1858 scicos_print(_("overflow error"));
1859 set_block_error(-4);
1860 return;
1861 }
1862 }
1863 else
1864 {
1865 y[i] = (SCSINT8_COP)(u[i]);
1866 }
1867 }
1868 break;
1869 }
1870 }
1871 }
1872 }
1873 /*--------------------------------------------------------------------------*/
1874