2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2012 - Scilab Enterprises - Antoine ELIAS
4 * Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
6 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at
10 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
16 #include "os_string.h"
19 #include "types_or.hxx"
25 using namespace types;
27 //define arrays on operation functions
28 static or_function pOrfunction[types::InternalType::IdLast][types::InternalType::IdLast] = {NULL};
32 #define scilab_fill_or(id1, id2, func, typeIn1, typeIn2, typeOut) \
33 pOrfunction[types::InternalType::Id ## id1][types::InternalType::Id ## id2] = (or_function)&or_##func<typeIn1, typeIn2, typeOut>
36 scilab_fill_or(Double, Double, M_M, Double, Double, Bool);
37 scilab_fill_or(Double, Bool, M_M, Double, Bool, Bool);
39 scilab_fill_or(Double, ScalarDouble, M_S, Double, Double, Bool);
40 scilab_fill_or(Double, ScalarBool, M_S, Double, Bool, Bool);
42 scilab_fill_or(Double, Empty, M_E, Double, Double, Double);
43 scilab_fill_or(Double, Identity, M_S, Double, Double, Bool);
45 scilab_fill_or(ScalarDouble, Double, S_M, Double, Double, Bool);
46 scilab_fill_or(ScalarDouble, Bool, S_M, Double, Bool, Bool);
48 scilab_fill_or(ScalarDouble, ScalarDouble, S_S, Double, Double, Bool);
49 scilab_fill_or(ScalarDouble, ScalarBool, S_S, Double, Bool, Bool);
51 scilab_fill_or(ScalarDouble, Empty, M_E, Double, Double, Double);
52 scilab_fill_or(ScalarDouble, Identity, S_S, Double, Double, Bool);
55 scilab_fill_or(Bool, Double, M_M, Bool, Double, Bool);
56 scilab_fill_or(Bool, Bool, M_M, Bool, Bool, Bool);
58 scilab_fill_or(Bool, ScalarDouble, M_S, Bool, Double, Bool);
59 scilab_fill_or(Bool, ScalarBool, M_S, Bool, Bool, Bool);
61 scilab_fill_or(Bool, Empty, M_E, Bool, Double, Bool);
62 scilab_fill_or(Bool, Identity, M_S, Bool, Double, Bool);
64 scilab_fill_or(ScalarBool, Double, S_M, Bool, Double, Bool);
65 scilab_fill_or(ScalarBool, Bool, S_M, Bool, Bool, Bool);
67 scilab_fill_or(ScalarBool, ScalarDouble, S_S, Bool, Double, Bool);
68 scilab_fill_or(ScalarBool, ScalarBool, S_S, Bool, Bool, Bool);
70 scilab_fill_or(ScalarBool, Empty, M_E, Bool, Double, Bool);
71 scilab_fill_or(ScalarBool, Identity, S_S, Bool, Double, Bool);
74 scilab_fill_or(Empty, Double, E_M, Double, Double, Double);
75 scilab_fill_or(Empty, Bool, E_M, Double, Bool, Bool);
76 scilab_fill_or(Empty, ScalarDouble, E_M, Double, Double, Double);
77 scilab_fill_or(Empty, ScalarBool, E_M, Double, Bool, Bool);
78 scilab_fill_or(Empty, Empty, E_M, Double, Double, Double);
79 scilab_fill_or(Empty, Identity, E_M, Double, Double, Double);
82 scilab_fill_or(Identity, Double, I_M, Double, Double, Bool);
83 scilab_fill_or(Identity, Bool, I_M, Double, Bool, Bool);
85 scilab_fill_or(Identity, ScalarDouble, I_S, Double, Double, Bool);
86 scilab_fill_or(Identity, ScalarBool, I_S, Double, Bool, Bool);
88 scilab_fill_or(Identity, Empty, M_E, Double, Double, Bool);
89 scilab_fill_or(Identity, Identity, I_S, Double, Double, Bool);
93 scilab_fill_or(Int8, Int8, int_M_M, Int8, Int8, Int8);
94 scilab_fill_or(Int8, UInt8, int_M_M, Int8, UInt8, UInt8);
95 scilab_fill_or(Int8, Int16, int_M_M, Int8, Int16, Int16);
96 scilab_fill_or(Int8, UInt16, int_M_M, Int8, UInt16, UInt16);
97 scilab_fill_or(Int8, Int32, int_M_M, Int8, Int32, Int32);
98 scilab_fill_or(Int8, UInt32, int_M_M, Int8, UInt32, UInt32);
99 scilab_fill_or(Int8, Int64, int_M_M, Int8, Int64, Int64);
100 scilab_fill_or(Int8, UInt64, int_M_M, Int8, UInt64, UInt64);
102 scilab_fill_or(Int8, ScalarInt8, int_M_S, Int8, Int8, Int8);
103 scilab_fill_or(Int8, ScalarUInt8, int_M_S, Int8, UInt8, UInt8);
104 scilab_fill_or(Int8, ScalarInt16, int_M_S, Int8, Int16, Int16);
105 scilab_fill_or(Int8, ScalarUInt16, int_M_S, Int8, UInt16, UInt16);
106 scilab_fill_or(Int8, ScalarInt32, int_M_S, Int8, Int32, Int32);
107 scilab_fill_or(Int8, ScalarUInt32, int_M_S, Int8, UInt32, UInt32);
108 scilab_fill_or(Int8, ScalarInt64, int_M_S, Int8, Int64, Int64);
109 scilab_fill_or(Int8, ScalarUInt64, int_M_S, Int8, UInt64, UInt64);
111 scilab_fill_or(ScalarInt8, Int8, int_S_M, Int8, Int8, Int8);
112 scilab_fill_or(ScalarInt8, UInt8, int_S_M, Int8, UInt8, UInt8);
113 scilab_fill_or(ScalarInt8, Int16, int_S_M, Int8, Int16, Int16);
114 scilab_fill_or(ScalarInt8, UInt16, int_S_M, Int8, UInt16, UInt16);
115 scilab_fill_or(ScalarInt8, Int32, int_S_M, Int8, Int32, Int32);
116 scilab_fill_or(ScalarInt8, UInt32, int_S_M, Int8, UInt32, UInt32);
117 scilab_fill_or(ScalarInt8, Int64, int_S_M, Int8, Int64, Int64);
118 scilab_fill_or(ScalarInt8, UInt64, int_S_M, Int8, UInt64, UInt64);
120 scilab_fill_or(ScalarInt8, ScalarInt8, int_S_S, Int8, Int8, Int8);
121 scilab_fill_or(ScalarInt8, ScalarUInt8, int_S_S, Int8, UInt8, UInt8);
122 scilab_fill_or(ScalarInt8, ScalarInt16, int_S_S, Int8, Int16, Int16);
123 scilab_fill_or(ScalarInt8, ScalarUInt16, int_S_S, Int8, UInt16, UInt16);
124 scilab_fill_or(ScalarInt8, ScalarInt32, int_S_S, Int8, Int32, Int32);
125 scilab_fill_or(ScalarInt8, ScalarUInt32, int_S_S, Int8, UInt32, UInt32);
126 scilab_fill_or(ScalarInt8, ScalarInt64, int_S_S, Int8, Int64, Int64);
127 scilab_fill_or(ScalarInt8, ScalarUInt64, int_S_S, Int8, UInt64, UInt64);
130 scilab_fill_or(UInt8, Int8, int_M_M, UInt8, Int8, UInt8);
131 scilab_fill_or(UInt8, UInt8, int_M_M, UInt8, UInt8, UInt8);
132 scilab_fill_or(UInt8, Int16, int_M_M, UInt8, Int16, UInt16);
133 scilab_fill_or(UInt8, UInt16, int_M_M, UInt8, UInt16, UInt16);
134 scilab_fill_or(UInt8, Int32, int_M_M, UInt8, Int32, UInt32);
135 scilab_fill_or(UInt8, UInt32, int_M_M, UInt8, UInt32, UInt32);
136 scilab_fill_or(UInt8, Int64, int_M_M, UInt8, Int64, UInt64);
137 scilab_fill_or(UInt8, UInt64, int_M_M, UInt8, UInt64, UInt64);
139 scilab_fill_or(UInt8, ScalarInt8, int_M_S, UInt8, Int8, UInt8);
140 scilab_fill_or(UInt8, ScalarUInt8, int_M_S, UInt8, UInt8, UInt8);
141 scilab_fill_or(UInt8, ScalarInt16, int_M_S, UInt8, Int16, UInt16);
142 scilab_fill_or(UInt8, ScalarUInt16, int_M_S, UInt8, UInt16, UInt16);
143 scilab_fill_or(UInt8, ScalarInt32, int_M_S, UInt8, Int32, UInt32);
144 scilab_fill_or(UInt8, ScalarUInt32, int_M_S, UInt8, UInt32, UInt32);
145 scilab_fill_or(UInt8, ScalarInt64, int_M_S, UInt8, Int64, UInt64);
146 scilab_fill_or(UInt8, ScalarUInt64, int_M_S, UInt8, UInt64, UInt64);
148 scilab_fill_or(ScalarUInt8, Int8, int_S_M, UInt8, Int8, UInt8);
149 scilab_fill_or(ScalarUInt8, UInt8, int_S_M, UInt8, UInt8, UInt8);
150 scilab_fill_or(ScalarUInt8, Int16, int_S_M, UInt8, Int16, UInt16);
151 scilab_fill_or(ScalarUInt8, UInt16, int_S_M, UInt8, UInt16, UInt16);
152 scilab_fill_or(ScalarUInt8, Int32, int_S_M, UInt8, Int32, UInt32);
153 scilab_fill_or(ScalarUInt8, UInt32, int_S_M, UInt8, UInt32, UInt32);
154 scilab_fill_or(ScalarUInt8, Int64, int_S_M, UInt8, Int64, UInt64);
155 scilab_fill_or(ScalarUInt8, UInt64, int_S_M, UInt8, UInt64, UInt64);
157 scilab_fill_or(ScalarUInt8, ScalarInt8, int_S_S, UInt8, Int8, UInt8);
158 scilab_fill_or(ScalarUInt8, ScalarUInt8, int_S_S, UInt8, UInt8, UInt8);
159 scilab_fill_or(ScalarUInt8, ScalarInt16, int_S_S, UInt8, Int16, UInt16);
160 scilab_fill_or(ScalarUInt8, ScalarUInt16, int_S_S, UInt8, UInt16, UInt16);
161 scilab_fill_or(ScalarUInt8, ScalarInt32, int_S_S, UInt8, Int32, UInt32);
162 scilab_fill_or(ScalarUInt8, ScalarUInt32, int_S_S, UInt8, UInt32, UInt32);
163 scilab_fill_or(ScalarUInt8, ScalarInt64, int_S_S, UInt8, Int64, UInt64);
164 scilab_fill_or(ScalarUInt8, ScalarUInt64, int_S_S, UInt8, UInt64, UInt64);
167 scilab_fill_or(Int16, Int8, int_M_M, Int16, Int8, Int16);
168 scilab_fill_or(Int16, UInt8, int_M_M, Int16, UInt8, UInt16);
169 scilab_fill_or(Int16, Int16, int_M_M, Int16, Int16, Int16);
170 scilab_fill_or(Int16, UInt16, int_M_M, Int16, UInt16, UInt16);
171 scilab_fill_or(Int16, Int32, int_M_M, Int16, Int32, Int32);
172 scilab_fill_or(Int16, UInt32, int_M_M, Int16, UInt32, UInt32);
173 scilab_fill_or(Int16, Int64, int_M_M, Int16, Int64, Int64);
174 scilab_fill_or(Int16, UInt64, int_M_M, Int16, UInt64, UInt64);
176 scilab_fill_or(Int16, ScalarInt8, int_M_S, Int16, Int8, Int16);
177 scilab_fill_or(Int16, ScalarUInt8, int_M_S, Int16, UInt8, UInt16);
178 scilab_fill_or(Int16, ScalarInt16, int_M_S, Int16, Int16, Int16);
179 scilab_fill_or(Int16, ScalarUInt16, int_M_S, Int16, UInt16, UInt16);
180 scilab_fill_or(Int16, ScalarInt32, int_M_S, Int16, Int32, Int32);
181 scilab_fill_or(Int16, ScalarUInt32, int_M_S, Int16, UInt32, UInt32);
182 scilab_fill_or(Int16, ScalarInt64, int_M_S, Int16, Int64, Int64);
183 scilab_fill_or(Int16, ScalarUInt64, int_M_S, Int16, UInt64, UInt64);
185 scilab_fill_or(ScalarInt16, Int8, int_S_M, Int16, Int8, Int16);
186 scilab_fill_or(ScalarInt16, UInt8, int_S_M, Int16, UInt8, UInt16);
187 scilab_fill_or(ScalarInt16, Int16, int_S_M, Int16, Int16, Int16);
188 scilab_fill_or(ScalarInt16, UInt16, int_S_M, Int16, UInt16, UInt16);
189 scilab_fill_or(ScalarInt16, Int32, int_S_M, Int16, Int32, Int32);
190 scilab_fill_or(ScalarInt16, UInt32, int_S_M, Int16, UInt32, UInt32);
191 scilab_fill_or(ScalarInt16, Int64, int_S_M, Int16, Int64, Int64);
192 scilab_fill_or(ScalarInt16, UInt64, int_S_M, Int16, UInt64, UInt64);
194 scilab_fill_or(ScalarInt16, ScalarInt8, int_S_S, Int16, Int8, Int16);
195 scilab_fill_or(ScalarInt16, ScalarUInt8, int_S_S, Int16, UInt8, UInt16);
196 scilab_fill_or(ScalarInt16, ScalarInt16, int_S_S, Int16, Int16, Int16);
197 scilab_fill_or(ScalarInt16, ScalarUInt16, int_S_S, Int16, UInt16, UInt16);
198 scilab_fill_or(ScalarInt16, ScalarInt32, int_S_S, Int16, Int32, Int32);
199 scilab_fill_or(ScalarInt16, ScalarUInt32, int_S_S, Int16, UInt32, UInt32);
200 scilab_fill_or(ScalarInt16, ScalarInt64, int_S_S, Int16, Int64, Int64);
201 scilab_fill_or(ScalarInt16, ScalarUInt64, int_S_S, Int16, UInt64, UInt64);
204 scilab_fill_or(UInt16, Int8, int_M_M, UInt16, Int8, UInt16);
205 scilab_fill_or(UInt16, UInt8, int_M_M, UInt16, UInt8, UInt16);
206 scilab_fill_or(UInt16, Int16, int_M_M, UInt16, Int16, UInt16);
207 scilab_fill_or(UInt16, UInt16, int_M_M, UInt16, UInt16, UInt16);
208 scilab_fill_or(UInt16, Int32, int_M_M, UInt16, Int32, UInt32);
209 scilab_fill_or(UInt16, UInt32, int_M_M, UInt16, UInt32, UInt32);
210 scilab_fill_or(UInt16, Int64, int_M_M, UInt16, Int64, UInt64);
211 scilab_fill_or(UInt16, UInt64, int_M_M, UInt16, UInt64, UInt64);
213 scilab_fill_or(UInt16, ScalarInt8, int_M_S, UInt16, Int8, UInt16);
214 scilab_fill_or(UInt16, ScalarUInt8, int_M_S, UInt16, UInt8, UInt16);
215 scilab_fill_or(UInt16, ScalarInt16, int_M_S, UInt16, Int16, UInt16);
216 scilab_fill_or(UInt16, ScalarUInt16, int_M_S, UInt16, UInt16, UInt16);
217 scilab_fill_or(UInt16, ScalarInt32, int_M_S, UInt16, Int32, UInt32);
218 scilab_fill_or(UInt16, ScalarUInt32, int_M_S, UInt16, UInt32, UInt32);
219 scilab_fill_or(UInt16, ScalarInt64, int_M_S, UInt16, Int64, UInt64);
220 scilab_fill_or(UInt16, ScalarUInt64, int_M_S, UInt16, UInt64, UInt64);
222 scilab_fill_or(ScalarUInt16, Int8, int_S_M, UInt16, Int8, UInt16);
223 scilab_fill_or(ScalarUInt16, UInt8, int_S_M, UInt16, UInt8, UInt16);
224 scilab_fill_or(ScalarUInt16, Int16, int_S_M, UInt16, Int16, UInt16);
225 scilab_fill_or(ScalarUInt16, UInt16, int_S_M, UInt16, UInt16, UInt16);
226 scilab_fill_or(ScalarUInt16, Int32, int_S_M, UInt16, Int32, UInt32);
227 scilab_fill_or(ScalarUInt16, UInt32, int_S_M, UInt16, UInt32, UInt32);
228 scilab_fill_or(ScalarUInt16, Int64, int_S_M, UInt16, Int64, UInt64);
229 scilab_fill_or(ScalarUInt16, UInt64, int_S_M, UInt16, UInt64, UInt64);
231 scilab_fill_or(ScalarUInt16, ScalarInt8, int_S_S, UInt16, Int8, UInt16);
232 scilab_fill_or(ScalarUInt16, ScalarUInt8, int_S_S, UInt16, UInt8, UInt16);
233 scilab_fill_or(ScalarUInt16, ScalarInt16, int_S_S, UInt16, Int16, UInt16);
234 scilab_fill_or(ScalarUInt16, ScalarUInt16, int_S_S, UInt16, UInt16, UInt16);
235 scilab_fill_or(ScalarUInt16, ScalarInt32, int_S_S, UInt16, Int32, UInt32);
236 scilab_fill_or(ScalarUInt16, ScalarUInt32, int_S_S, UInt16, UInt32, UInt32);
237 scilab_fill_or(ScalarUInt16, ScalarInt64, int_S_S, UInt16, Int64, UInt64);
238 scilab_fill_or(ScalarUInt16, ScalarUInt64, int_S_S, UInt16, UInt64, UInt64);
241 scilab_fill_or(Int32, Int8, int_M_M, Int32, Int8, Int32);
242 scilab_fill_or(Int32, UInt8, int_M_M, Int32, UInt8, UInt32);
243 scilab_fill_or(Int32, Int16, int_M_M, Int32, Int16, Int32);
244 scilab_fill_or(Int32, UInt16, int_M_M, Int32, UInt16, UInt32);
245 scilab_fill_or(Int32, Int32, int_M_M, Int32, Int32, Int32);
246 scilab_fill_or(Int32, UInt32, int_M_M, Int32, UInt32, UInt32);
247 scilab_fill_or(Int32, Int64, int_M_M, Int32, Int64, Int64);
248 scilab_fill_or(Int32, UInt64, int_M_M, Int32, UInt64, UInt64);
250 scilab_fill_or(Int32, ScalarInt8, int_M_S, Int32, Int8, Int32);
251 scilab_fill_or(Int32, ScalarUInt8, int_M_S, Int32, UInt8, UInt32);
252 scilab_fill_or(Int32, ScalarInt16, int_M_S, Int32, Int16, Int32);
253 scilab_fill_or(Int32, ScalarUInt16, int_M_S, Int32, UInt16, UInt32);
254 scilab_fill_or(Int32, ScalarInt32, int_M_S, Int32, Int32, Int32);
255 scilab_fill_or(Int32, ScalarUInt32, int_M_S, Int32, UInt32, UInt32);
256 scilab_fill_or(Int32, ScalarInt64, int_M_S, Int32, Int64, Int64);
257 scilab_fill_or(Int32, ScalarUInt64, int_M_S, Int32, UInt64, UInt64);
259 scilab_fill_or(ScalarInt32, Int8, int_S_M, Int32, Int8, Int32);
260 scilab_fill_or(ScalarInt32, UInt8, int_S_M, Int32, UInt8, UInt32);
261 scilab_fill_or(ScalarInt32, Int16, int_S_M, Int32, Int16, Int32);
262 scilab_fill_or(ScalarInt32, UInt16, int_S_M, Int32, UInt16, UInt32);
263 scilab_fill_or(ScalarInt32, Int32, int_S_M, Int32, Int32, Int32);
264 scilab_fill_or(ScalarInt32, UInt32, int_S_M, Int32, UInt32, UInt32);
265 scilab_fill_or(ScalarInt32, Int64, int_S_M, Int32, Int64, Int64);
266 scilab_fill_or(ScalarInt32, UInt64, int_S_M, Int32, UInt64, UInt64);
268 scilab_fill_or(ScalarInt32, ScalarInt8, int_S_S, Int32, Int8, Int32);
269 scilab_fill_or(ScalarInt32, ScalarUInt8, int_S_S, Int32, UInt8, UInt32);
270 scilab_fill_or(ScalarInt32, ScalarInt16, int_S_S, Int32, Int16, Int32);
271 scilab_fill_or(ScalarInt32, ScalarUInt16, int_S_S, Int32, UInt16, UInt32);
272 scilab_fill_or(ScalarInt32, ScalarInt32, int_S_S, Int32, Int32, Int32);
273 scilab_fill_or(ScalarInt32, ScalarUInt32, int_S_S, Int32, UInt32, UInt32);
274 scilab_fill_or(ScalarInt32, ScalarInt64, int_S_S, Int32, Int64, Int64);
275 scilab_fill_or(ScalarInt32, ScalarUInt64, int_S_S, Int32, UInt64, UInt64);
278 scilab_fill_or(UInt32, Int8, int_M_M, UInt32, Int8, UInt32);
279 scilab_fill_or(UInt32, UInt8, int_M_M, UInt32, UInt8, UInt32);
280 scilab_fill_or(UInt32, Int16, int_M_M, UInt32, Int16, UInt32);
281 scilab_fill_or(UInt32, UInt16, int_M_M, UInt32, UInt16, UInt32);
282 scilab_fill_or(UInt32, Int32, int_M_M, UInt32, Int32, UInt32);
283 scilab_fill_or(UInt32, UInt32, int_M_M, UInt32, UInt32, UInt32);
284 scilab_fill_or(UInt32, Int64, int_M_M, UInt32, Int64, UInt64);
285 scilab_fill_or(UInt32, UInt64, int_M_M, UInt32, UInt64, UInt64);
287 scilab_fill_or(UInt32, ScalarInt8, int_M_S, UInt32, Int8, UInt32);
288 scilab_fill_or(UInt32, ScalarUInt8, int_M_S, UInt32, UInt8, UInt32);
289 scilab_fill_or(UInt32, ScalarInt16, int_M_S, UInt32, Int16, UInt32);
290 scilab_fill_or(UInt32, ScalarUInt16, int_M_S, UInt32, UInt16, UInt32);
291 scilab_fill_or(UInt32, ScalarInt32, int_M_S, UInt32, Int32, UInt32);
292 scilab_fill_or(UInt32, ScalarUInt32, int_M_S, UInt32, UInt32, UInt32);
293 scilab_fill_or(UInt32, ScalarInt64, int_M_S, UInt32, Int64, UInt64);
294 scilab_fill_or(UInt32, ScalarUInt64, int_M_S, UInt32, UInt64, UInt64);
296 scilab_fill_or(ScalarUInt32, Int8, int_S_M, UInt32, Int8, UInt32);
297 scilab_fill_or(ScalarUInt32, UInt8, int_S_M, UInt32, UInt8, UInt32);
298 scilab_fill_or(ScalarUInt32, Int16, int_S_M, UInt32, Int16, UInt32);
299 scilab_fill_or(ScalarUInt32, UInt16, int_S_M, UInt32, UInt16, UInt32);
300 scilab_fill_or(ScalarUInt32, Int32, int_S_M, UInt32, Int32, UInt32);
301 scilab_fill_or(ScalarUInt32, UInt32, int_S_M, UInt32, UInt32, UInt32);
302 scilab_fill_or(ScalarUInt32, Int64, int_S_M, UInt32, Int64, UInt64);
303 scilab_fill_or(ScalarUInt32, UInt64, int_S_M, UInt32, UInt64, UInt64);
305 scilab_fill_or(ScalarUInt32, ScalarInt8, int_S_S, UInt32, Int8, UInt32);
306 scilab_fill_or(ScalarUInt32, ScalarUInt8, int_S_S, UInt32, UInt8, UInt32);
307 scilab_fill_or(ScalarUInt32, ScalarInt16, int_S_S, UInt32, Int16, UInt32);
308 scilab_fill_or(ScalarUInt32, ScalarUInt16, int_S_S, UInt32, UInt16, UInt32);
309 scilab_fill_or(ScalarUInt32, ScalarInt32, int_S_S, UInt32, Int32, UInt32);
310 scilab_fill_or(ScalarUInt32, ScalarUInt32, int_S_S, UInt32, UInt32, UInt32);
311 scilab_fill_or(ScalarUInt32, ScalarInt64, int_S_S, UInt32, Int64, UInt64);
312 scilab_fill_or(ScalarUInt32, ScalarUInt64, int_S_S, UInt32, UInt64, UInt64);
315 scilab_fill_or(Int64, Int8, int_M_M, Int64, Int8, Int64);
316 scilab_fill_or(Int64, UInt8, int_M_M, Int64, UInt8, UInt64);
317 scilab_fill_or(Int64, Int16, int_M_M, Int64, Int16, Int64);
318 scilab_fill_or(Int64, UInt16, int_M_M, Int64, UInt16, UInt64);
319 scilab_fill_or(Int64, Int32, int_M_M, Int64, Int32, Int64);
320 scilab_fill_or(Int64, UInt32, int_M_M, Int64, UInt32, UInt64);
321 scilab_fill_or(Int64, Int64, int_M_M, Int64, Int64, Int64);
322 scilab_fill_or(Int64, UInt64, int_M_M, Int64, UInt64, UInt64);
324 scilab_fill_or(Int64, ScalarInt8, int_M_S, Int64, Int8, Int64);
325 scilab_fill_or(Int64, ScalarUInt8, int_M_S, Int64, UInt8, UInt64);
326 scilab_fill_or(Int64, ScalarInt16, int_M_S, Int64, Int16, Int64);
327 scilab_fill_or(Int64, ScalarUInt16, int_M_S, Int64, UInt16, UInt64);
328 scilab_fill_or(Int64, ScalarInt32, int_M_S, Int64, Int32, Int64);
329 scilab_fill_or(Int64, ScalarUInt32, int_M_S, Int64, UInt32, UInt64);
330 scilab_fill_or(Int64, ScalarInt64, int_M_S, Int64, Int64, Int64);
331 scilab_fill_or(Int64, ScalarUInt64, int_M_S, Int64, UInt64, UInt64);
333 scilab_fill_or(ScalarInt64, Int8, int_S_M, Int64, Int8, Int64);
334 scilab_fill_or(ScalarInt64, UInt8, int_S_M, Int64, UInt8, UInt64);
335 scilab_fill_or(ScalarInt64, Int16, int_S_M, Int64, Int16, Int64);
336 scilab_fill_or(ScalarInt64, UInt16, int_S_M, Int64, UInt16, UInt64);
337 scilab_fill_or(ScalarInt64, Int32, int_S_M, Int64, Int32, Int64);
338 scilab_fill_or(ScalarInt64, UInt32, int_S_M, Int64, UInt32, UInt64);
339 scilab_fill_or(ScalarInt64, Int64, int_S_M, Int64, Int64, Int64);
340 scilab_fill_or(ScalarInt64, UInt64, int_S_M, Int64, UInt64, UInt64);
342 scilab_fill_or(ScalarInt64, ScalarInt8, int_S_S, Int64, Int8, Int64);
343 scilab_fill_or(ScalarInt64, ScalarUInt8, int_S_S, Int64, UInt8, UInt64);
344 scilab_fill_or(ScalarInt64, ScalarInt16, int_S_S, Int64, Int16, Int64);
345 scilab_fill_or(ScalarInt64, ScalarUInt16, int_S_S, Int64, UInt16, UInt64);
346 scilab_fill_or(ScalarInt64, ScalarInt32, int_S_S, Int64, Int32, Int64);
347 scilab_fill_or(ScalarInt64, ScalarUInt32, int_S_S, Int64, UInt32, UInt64);
348 scilab_fill_or(ScalarInt64, ScalarInt64, int_S_S, Int64, Int64, Int64);
349 scilab_fill_or(ScalarInt64, ScalarUInt64, int_S_S, Int64, UInt64, UInt64);
352 scilab_fill_or(UInt64, Int8, int_M_M, UInt64, Int8, UInt64);
353 scilab_fill_or(UInt64, UInt8, int_M_M, UInt64, UInt8, UInt64);
354 scilab_fill_or(UInt64, Int16, int_M_M, UInt64, Int16, UInt64);
355 scilab_fill_or(UInt64, UInt16, int_M_M, UInt64, UInt16, UInt64);
356 scilab_fill_or(UInt64, Int32, int_M_M, UInt64, Int32, UInt64);
357 scilab_fill_or(UInt64, UInt32, int_M_M, UInt64, UInt32, UInt64);
358 scilab_fill_or(UInt64, Int64, int_M_M, UInt64, Int64, UInt64);
359 scilab_fill_or(UInt64, UInt64, int_M_M, UInt64, UInt64, UInt64);
361 scilab_fill_or(UInt64, ScalarInt8, int_M_S, UInt64, Int8, UInt64);
362 scilab_fill_or(UInt64, ScalarUInt8, int_M_S, UInt64, UInt8, UInt64);
363 scilab_fill_or(UInt64, ScalarInt16, int_M_S, UInt64, Int16, UInt64);
364 scilab_fill_or(UInt64, ScalarUInt16, int_M_S, UInt64, UInt16, UInt64);
365 scilab_fill_or(UInt64, ScalarInt32, int_M_S, UInt64, Int32, UInt64);
366 scilab_fill_or(UInt64, ScalarUInt32, int_M_S, UInt64, UInt32, UInt64);
367 scilab_fill_or(UInt64, ScalarInt64, int_M_S, UInt64, Int64, UInt64);
368 scilab_fill_or(UInt64, ScalarUInt64, int_M_S, UInt64, UInt64, UInt64);
370 scilab_fill_or(ScalarUInt64, Int8, int_S_M, UInt64, Int8, UInt64);
371 scilab_fill_or(ScalarUInt64, UInt8, int_S_M, UInt64, UInt8, UInt64);
372 scilab_fill_or(ScalarUInt64, Int16, int_S_M, UInt64, Int16, UInt64);
373 scilab_fill_or(ScalarUInt64, UInt16, int_S_M, UInt64, UInt16, UInt64);
374 scilab_fill_or(ScalarUInt64, Int32, int_S_M, UInt64, Int32, UInt64);
375 scilab_fill_or(ScalarUInt64, UInt32, int_S_M, UInt64, UInt32, UInt64);
376 scilab_fill_or(ScalarUInt64, Int64, int_S_M, UInt64, Int64, UInt64);
377 scilab_fill_or(ScalarUInt64, UInt64, int_S_M, UInt64, UInt64, UInt64);
379 scilab_fill_or(ScalarUInt64, ScalarInt8, int_S_S, UInt64, Int8, UInt64);
380 scilab_fill_or(ScalarUInt64, ScalarUInt8, int_S_S, UInt64, UInt8, UInt64);
381 scilab_fill_or(ScalarUInt64, ScalarInt16, int_S_S, UInt64, Int16, UInt64);
382 scilab_fill_or(ScalarUInt64, ScalarUInt16, int_S_S, UInt64, UInt16, UInt64);
383 scilab_fill_or(ScalarUInt64, ScalarInt32, int_S_S, UInt64, Int32, UInt64);
384 scilab_fill_or(ScalarUInt64, ScalarUInt32, int_S_S, UInt64, UInt32, UInt64);
385 scilab_fill_or(ScalarUInt64, ScalarInt64, int_S_S, UInt64, Int64, UInt64);
386 scilab_fill_or(ScalarUInt64, ScalarUInt64, int_S_S, UInt64, UInt64, UInt64);
389 scilab_fill_or(SparseBool, SparseBool, M_M, SparseBool, SparseBool, SparseBool);
390 scilab_fill_or(Bool, SparseBool, M_M, Bool, SparseBool, SparseBool);
391 scilab_fill_or(SparseBool, Bool, M_M, SparseBool, Bool, SparseBool);
392 scilab_fill_or(ScalarBool, SparseBool, M_M, Bool, SparseBool, SparseBool);
393 scilab_fill_or(SparseBool, ScalarBool, M_M, SparseBool, Bool, SparseBool);
395 #undef scilab_fill_or
399 InternalType* GenericShortcutOr(InternalType* _pL)
401 InternalType* pResult = NULL;
405 BoolOrBool(_pL->getAs<Bool>(), (Bool**)&pResult);
410 DoubleOrDouble(_pL->getAs<Double>(), (Bool**)&pResult);
415 IntOrInt(_pL, (Bool**)&pResult);
418 if (_pL->isSparseBool())
420 SparseBoolOrSparseBool(_pL, (Bool**)&pResult);
427 InternalType* GenericLogicalOr(InternalType* _pL, InternalType* _pR)
429 InternalType *pResult = NULL;
431 or_function bit_or = pOrfunction[_pL->getId()][_pR->getId()];
434 pResult = bit_or(_pL, _pR);
442 ** Default case : Return NULL will Call Overloading.
447 int BoolOrBool(Bool* _pL, Bool** _pOut)
449 for (int i = 0 ; i < _pL->getSize() ; i++)
451 if (_pL->get(i) == 0)
453 //call non shorcut opearion
459 *_pOut = new Bool(1); //true || something -> true
463 int DoubleOrDouble(Double* _pL, Bool** _pOut)
467 //call non shorcut operation
472 for (int i = 0 ; i < _pL->getSize() ; i++)
474 if (_pL->get(i) == 0)
476 //call non shorcut operation
482 *_pOut = new Bool(1); //true || something -> true
487 static int IntOrInt(K* _pL, Bool** _pOut)
489 for (int i = 0 ; i < _pL->getSize() ; i++)
491 if (_pL->get(i) == 0)
493 //call non shorcut opearion
499 *_pOut = new Bool(1); //true || something -> true
503 int IntOrInt(InternalType* _pL, Bool** _pOut)
505 switch (_pL->getType())
507 case InternalType::ScilabInt8 :
509 return IntOrInt(_pL->getAs<Int8>(), _pOut);
511 case InternalType::ScilabUInt8 :
513 return IntOrInt(_pL->getAs<UInt8>(), _pOut);
515 case InternalType::ScilabInt16 :
517 return IntOrInt(_pL->getAs<Int16>(), _pOut);
519 case InternalType::ScilabUInt16 :
521 return IntOrInt(_pL->getAs<UInt16>(), _pOut);
523 case InternalType::ScilabInt32 :
525 return IntOrInt(_pL->getAs<Int32>(), _pOut);
527 case InternalType::ScilabUInt32 :
529 return IntOrInt(_pL->getAs<UInt32>(), _pOut);
531 case InternalType::ScilabInt64 :
533 return IntOrInt(_pL->getAs<Int64>(), _pOut);
535 case InternalType::ScilabUInt64 :
537 return IntOrInt(_pL->getAs<UInt64>(), _pOut);
546 int SparseBoolOrSparseBool(InternalType* _pL, Bool** _pOut)
548 SparseBool* pL = _pL->getAs<SparseBool>();
549 if (pL->nbTrue() == pL->getSize())
551 *_pOut = new Bool(1);
559 template<class T, class U, class O>
560 InternalType* or_M_M(T *_pL, U *_pR)
562 int iDimsL = _pL->getDims();
563 int iDimsR = _pR->getDims();
565 if (iDimsL != iDimsR)
567 throw ast::InternalError(_W("Inconsistent row/column dimensions.\n"));
570 int* piDimsL = _pL->getDimsArray();
571 int* piDimsR = _pR->getDimsArray();
573 for (int i = 0 ; i < iDimsL ; ++i)
575 if (piDimsL[i] != piDimsR[i])
577 throw ast::InternalError(_W("Inconsistent row/column dimensions.\n"));
581 O* pOut = new O(iDimsL, piDimsL);
583 bit_or(_pL->get(), (long long)_pL->getSize(), _pR->get(), pOut->get());
587 template<class T, class U, class O>
588 InternalType* or_S_M(T *_pL, U *_pR)
590 O* pOut = new O(_pR->getDims(), _pR->getDimsArray());
591 bit_or(_pL->get(0), (size_t)_pR->getSize(), _pR->get(), pOut->get());
595 template<class T, class U, class O>
596 InternalType* or_M_S(T *_pL, U *_pR)
598 O* pOut = new O(_pL->getDims(), _pL->getDimsArray());
599 bit_or(_pL->get(), (size_t)_pL->getSize(), _pR->get(0), pOut->get());
603 template<class T, class U, class O>
604 InternalType* or_S_S(T *_pL, U *_pR)
606 O* pOut = new O(_pL->getDims(), _pL->getDimsArray());
607 bit_or(_pL->get(0), _pR->get(0), pOut->get());
611 template<class T, class U, class O>
612 InternalType* or_M_E(T *_pL, U *_pR)
618 InternalType* or_M_E<Bool, Double, Bool>(Bool* _pL, Double* /* _pR */)
620 Bool* pOut = new Bool(_pL->getDims(), _pL->getDimsArray());
625 template<class T, class U, class O>
626 InternalType* or_E_M(T *_pL, U *_pR)
632 InternalType* or_E_M<Double, Bool, Bool>(Double* /* _pL */, Bool* _pR)
634 Bool* pOut = new Bool(_pR->getDims(), _pR->getDimsArray());
639 template<class T, class U, class O>
640 InternalType* or_I_S(T *_pL, U *_pR)
642 return or_S_S<U, T, O>(_pR, _pL);
645 template<class T, class U, class O>
646 InternalType* or_I_M(T *_pL, U *_pR)
648 return or_M_S<U, T, O>(_pR, _pL);
652 template<class T, class U, class O>
653 InternalType* or_int_M_M(T *_pL, U *_pR)
655 int iDimsL = _pL->getDims();
656 int iDimsR = _pR->getDims();
658 if (iDimsL != iDimsR)
660 throw ast::InternalError(_W("Inconsistent row/column dimensions.\n"));
663 int* piDimsL = _pL->getDimsArray();
664 int* piDimsR = _pR->getDimsArray();
666 for (int i = 0 ; i < iDimsL ; ++i)
668 if (piDimsL[i] != piDimsR[i])
670 throw ast::InternalError(_W("Inconsistent row/column dimensions.\n"));
674 O* pOut = new O(iDimsL, piDimsL);
676 int_or(_pL->get(), (long long)_pL->getSize(), _pR->get(), pOut->get());
680 template<class T, class U, class O>
681 InternalType* or_int_S_M(T *_pL, U *_pR)
683 O* pOut = new O(_pR->getDims(), _pR->getDimsArray());
684 int_or(_pL->get(0), (size_t)_pR->getSize(), _pR->get(), pOut->get());
688 template<class T, class U, class O>
689 InternalType* or_int_M_S(T *_pL, U *_pR)
691 O* pOut = new O(_pL->getDims(), _pL->getDimsArray());
692 int_or(_pL->get(), (size_t)_pL->getSize(), _pR->get(0), pOut->get());
696 template<class T, class U, class O>
697 InternalType* or_int_S_S(T *_pL, U *_pR)
699 O* pOut = new O(_pL->getDims(), _pL->getDimsArray());
700 int_or(_pL->get(0), _pR->get(0), pOut->get());
706 InternalType* or_M_M<SparseBool, SparseBool, SparseBool>(SparseBool* _pL, SparseBool* _pR)
708 SparseBool* pOut = NULL;
713 pOut = new SparseBool(_pR->getRows(), _pR->getCols());
714 int iCols = pOut->getCols();
715 int iRows = pOut->getRows();
716 for (int i = 0 ; i < iRows ; i++)
718 for (int j = 0 ; j < iCols ; j++)
720 pOut->set(i, j, true);
736 pOut = new SparseBool(_pL->getRows(), _pL->getCols());
737 int iCols = pOut->getCols();
738 int iRows = pOut->getRows();
739 for (int i = 0 ; i < iRows ; i++)
741 for (int j = 0 ; j < iCols ; j++)
743 pOut->set(i, j, true);
755 if (_pL->getRows() != _pR->getRows() || _pL->getCols() != _pR->getCols())
757 throw ast::InternalError(_W("Inconsistent row/column dimensions.\n"));
760 return _pL->newLogicalOr(*_pR);
764 InternalType* or_M_M<SparseBool, Bool, SparseBool>(SparseBool* _pL, Bool* _pR)
766 SparseBool* pR = new SparseBool(*_pR);
767 InternalType* pOut = or_M_M<SparseBool, SparseBool, SparseBool>(_pL, pR);
773 InternalType* or_M_M<Bool, SparseBool, SparseBool>(Bool* _pL, SparseBool* _pR)
775 SparseBool* pL = new SparseBool(*_pL);
776 InternalType* pOut = or_M_M<SparseBool, SparseBool, SparseBool>(pL, _pR);