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 /*--------------------------------------------------------------------------*/
24 #include "scicos_block4.h"
25 #include "dynlib_scicos_blocks.h"
26 /*--------------------------------------------------------------------------*/
27 SCICOS_BLOCKS_IMPEXP void matmul2_s(scicos_block *block, int flag)
33 int ut = GetInType(block, 1);
34 int mu = GetOutPortRows(block, 1);
35 int nu = GetOutPortCols(block, 1);
36 double *rpar = GetRparPtrs(block);
43 SCSINT32_COP *u1 = Getint32InPortPtrs(block, 1);
44 SCSINT32_COP *u2 = Getint32InPortPtrs(block, 2);
45 SCSINT32_COP *y1 = Getint32OutPortPtrs(block, 1);
46 for (i = 0; i < mu * nu; i++)
48 v = (double)u1[i] * (double)u2[i];
57 y1[i] = (SCSINT32_COP)v;
65 SCSINT16_COP *u1 = Getint16InPortPtrs(block, 1);
66 SCSINT16_COP *u2 = Getint16InPortPtrs(block, 2);
67 SCSINT16_COP *y1 = Getint16OutPortPtrs(block, 1);
68 for (i = 0; i < mu * nu; i++)
70 v = (double)u1[i] * (double)u2[i];
79 y1[i] = (SCSINT16_COP)v;
87 SCSINT8_COP *u1 = Getint8InPortPtrs(block, 1);
88 SCSINT8_COP *u2 = Getint8InPortPtrs(block, 2);
89 SCSINT8_COP *y1 = Getint8OutPortPtrs(block, 1);
90 for (i = 0; i < mu * nu; i++)
92 v = (double)u1[i] * (double)u2[i];
101 y1[i] = (SCSINT8_COP)v;
109 SCSUINT32_COP *u1 = Getuint32InPortPtrs(block, 1);
110 SCSUINT32_COP *u2 = Getuint32InPortPtrs(block, 2);
111 SCSUINT32_COP *y1 = Getuint32OutPortPtrs(block, 1);
112 for (i = 0; i < mu * nu; i++)
114 v = (double)u1[i] * (double)u2[i];
119 else if (v > rpar[1])
123 y1[i] = (SCSUINT32_COP)v;
131 SCSUINT16_COP *u1 = Getuint16InPortPtrs(block, 1);
132 SCSUINT16_COP *u2 = Getuint16InPortPtrs(block, 2);
133 SCSUINT16_COP *y1 = Getuint16OutPortPtrs(block, 1);
134 for (i = 0; i < mu * nu; i++)
136 v = (double)u1[i] * (double)u2[i];
141 else if (v > rpar[1])
145 y1[i] = (SCSUINT16_COP)v;
153 SCSUINT8_COP *u1 = Getuint8InPortPtrs(block, 1);
154 SCSUINT8_COP *u2 = Getuint8InPortPtrs(block, 2);
155 SCSUINT8_COP *y1 = Getuint8OutPortPtrs(block, 1);
156 for (i = 0; i < mu * nu; i++)
158 v = (double)u1[i] * (double)u2[i];
163 else if (v > rpar[1])
167 y1[i] = (SCSUINT8_COP)v;
181 /*--------------------------------------------------------------------------*/