3 * Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
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.
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.
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.
19 * See the file ./license.txt
21 /*--------------------------------------------------------------------------*/
25 #include "scicos_block4.h"
27 #include "localization.h"
28 #include "dynlib_scicos_blocks.h"
29 /*--------------------------------------------------------------------------*/
30 SCICOS_BLOCKS_IMPEXP void matmul2_e(scicos_block *block, int flag)
36 int ut = GetInType(block, 1);
37 int mu = GetOutPortRows(block, 1);
38 int nu = GetOutPortCols(block, 1);
39 double *rpar = GetRparPtrs(block);
46 SCSINT32_COP *u1 = Getint32InPortPtrs(block, 1);
47 SCSINT32_COP *u2 = Getint32InPortPtrs(block, 2);
48 SCSINT32_COP *y1 = Getint32OutPortPtrs(block, 1);
49 for (i = 0; i < mu * nu; i++)
51 v = (double)u1[i] * (double)u2[i];
52 if ((v < rpar[0]) | (v > rpar[1]))
54 sciprint(_("overflow error"));
60 y1[i] = (SCSUINT32_COP)v;
69 SCSINT16_COP *u1 = Getint16InPortPtrs(block, 1);
70 SCSINT16_COP *u2 = Getint16InPortPtrs(block, 2);
71 SCSINT16_COP *y1 = Getint16OutPortPtrs(block, 1);
72 for (i = 0; i < mu * nu; i++)
74 v = (double)u1[i] * (double)u2[i];
75 if ((v < rpar[0]) | (v > rpar[1]))
77 sciprint(_("overflow error"));
83 y1[i] = (SCSINT16_COP)v;
92 SCSINT8_COP *u1 = Getint8InPortPtrs(block, 1);
93 SCSINT8_COP *u2 = Getint8InPortPtrs(block, 2);
94 SCSINT8_COP *y1 = Getint8OutPortPtrs(block, 1);
95 for (i = 0; i < mu * nu; i++)
97 v = (double)u1[i] * (double)u2[i];
98 if ((v < rpar[0]) | (v > rpar[1]))
100 sciprint(_("overflow error"));
106 y1[i] = (SCSINT8_COP)v;
115 SCSUINT32_COP *u1 = Getuint32InPortPtrs(block, 1);
116 SCSUINT32_COP *u2 = Getuint32InPortPtrs(block, 2);
117 SCSUINT32_COP *y1 = Getuint32OutPortPtrs(block, 1);
118 for (i = 0; i < mu * nu; i++)
120 v = (double)u1[i] * (double)u2[i];
121 if ((v < rpar[0]) | (v > rpar[1]))
123 sciprint(_("overflow error"));
129 y1[i] = (SCSUINT32_COP)v;
138 SCSUINT16_COP *u1 = Getuint16InPortPtrs(block, 1);
139 SCSUINT16_COP *u2 = Getuint16InPortPtrs(block, 2);
140 SCSUINT16_COP *y1 = Getuint16OutPortPtrs(block, 1);
141 for (i = 0; i < mu * nu; i++)
143 v = (double)u1[i] * (double)u2[i];
144 if ((v < rpar[0]) | (v > rpar[1]))
146 sciprint(_("overflow error"));
152 y1[i] = (SCSUINT16_COP)v;
161 SCSUINT8_COP *u1 = Getuint8InPortPtrs(block, 1);
162 SCSUINT8_COP *u2 = Getuint8InPortPtrs(block, 2);
163 SCSUINT8_COP *y1 = Getuint8OutPortPtrs(block, 1);
164 for (i = 0; i < mu * nu; i++)
166 v = (double)u1[i] * (double)u2[i];
167 if ((v < rpar[0]) | (v > rpar[1]))
169 sciprint(_("overflow error"));
175 y1[i] = (SCSUINT8_COP)v;
189 /*--------------------------------------------------------------------------*/