1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2004-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29
30 #include "errwarn.h"
31 #include "ovl.h"
32 #include "ov.h"
33 #include "ov-int8.h"
34 #include "ov-int16.h"
35 #include "ov-int32.h"
36 #include "ov-int64.h"
37 #include "ov-uint8.h"
38 #include "ov-uint16.h"
39 #include "ov-uint32.h"
40 #include "ov-uint64.h"
41 #include "ov-range.h"
42 #include "ov-bool.h"
43 #include "ov-bool-mat.h"
44 #include "ov-scalar.h"
45 #include "ov-float.h"
46 #include "ov-re-mat.h"
47 #include "ov-flt-re-mat.h"
48 #include "ov-str-mat.h"
49 #include "ov-typeinfo.h"
50 #include "op-int.h"
51 #include "ops.h"
52
53 // Concatenation of mixed integer types:
54
OCTAVE_CONCAT_FN2(int8,int16)55 OCTAVE_CONCAT_FN2 (int8, int16)
56 OCTAVE_CONCAT_FN2 (int8, int32)
57 OCTAVE_CONCAT_FN2 (int8, int64)
58
59 OCTAVE_CONCAT_FN2 (int8, uint8)
60 OCTAVE_CONCAT_FN2 (int8, uint16)
61 OCTAVE_CONCAT_FN2 (int8, uint32)
62 OCTAVE_CONCAT_FN2 (int8, uint64)
63
64 OCTAVE_CONCAT_FN2 (int16, int8)
65 OCTAVE_CONCAT_FN2 (int16, int32)
66 OCTAVE_CONCAT_FN2 (int16, int64)
67
68 OCTAVE_CONCAT_FN2 (int16, uint8)
69 OCTAVE_CONCAT_FN2 (int16, uint16)
70 OCTAVE_CONCAT_FN2 (int16, uint32)
71 OCTAVE_CONCAT_FN2 (int16, uint64)
72
73 OCTAVE_CONCAT_FN2 (int32, int8)
74 OCTAVE_CONCAT_FN2 (int32, int16)
75 OCTAVE_CONCAT_FN2 (int32, int64)
76
77 OCTAVE_CONCAT_FN2 (int32, uint8)
78 OCTAVE_CONCAT_FN2 (int32, uint16)
79 OCTAVE_CONCAT_FN2 (int32, uint32)
80 OCTAVE_CONCAT_FN2 (int32, uint64)
81
82 OCTAVE_CONCAT_FN2 (int64, int8)
83 OCTAVE_CONCAT_FN2 (int64, int16)
84 OCTAVE_CONCAT_FN2 (int64, int32)
85
86 OCTAVE_CONCAT_FN2 (int64, uint8)
87 OCTAVE_CONCAT_FN2 (int64, uint16)
88 OCTAVE_CONCAT_FN2 (int64, uint32)
89 OCTAVE_CONCAT_FN2 (int64, uint64)
90
91 OCTAVE_CONCAT_FN2 (uint8, int8)
92 OCTAVE_CONCAT_FN2 (uint8, int16)
93 OCTAVE_CONCAT_FN2 (uint8, int32)
94 OCTAVE_CONCAT_FN2 (uint8, int64)
95
96 OCTAVE_CONCAT_FN2 (uint8, uint16)
97 OCTAVE_CONCAT_FN2 (uint8, uint32)
98 OCTAVE_CONCAT_FN2 (uint8, uint64)
99
100 OCTAVE_CONCAT_FN2 (uint16, int8)
101 OCTAVE_CONCAT_FN2 (uint16, int16)
102 OCTAVE_CONCAT_FN2 (uint16, int32)
103 OCTAVE_CONCAT_FN2 (uint16, int64)
104
105 OCTAVE_CONCAT_FN2 (uint16, uint8)
106 OCTAVE_CONCAT_FN2 (uint16, uint32)
107 OCTAVE_CONCAT_FN2 (uint16, uint64)
108
109 OCTAVE_CONCAT_FN2 (uint32, int8)
110 OCTAVE_CONCAT_FN2 (uint32, int16)
111 OCTAVE_CONCAT_FN2 (uint32, int32)
112 OCTAVE_CONCAT_FN2 (uint32, int64)
113
114 OCTAVE_CONCAT_FN2 (uint32, uint8)
115 OCTAVE_CONCAT_FN2 (uint32, uint16)
116 OCTAVE_CONCAT_FN2 (uint32, uint64)
117
118 OCTAVE_CONCAT_FN2 (uint64, int8)
119 OCTAVE_CONCAT_FN2 (uint64, int16)
120 OCTAVE_CONCAT_FN2 (uint64, int32)
121 OCTAVE_CONCAT_FN2 (uint64, int64)
122
123 OCTAVE_CONCAT_FN2 (uint64, uint8)
124 OCTAVE_CONCAT_FN2 (uint64, uint16)
125 OCTAVE_CONCAT_FN2 (uint64, uint32)
126
127 OCTAVE_INT_DOUBLE_CONCAT_FN (int8)
128 OCTAVE_INT_DOUBLE_CONCAT_FN (int16)
129 OCTAVE_INT_DOUBLE_CONCAT_FN (int32)
130 OCTAVE_INT_DOUBLE_CONCAT_FN (int64)
131
132 OCTAVE_INT_DOUBLE_CONCAT_FN (uint8)
133 OCTAVE_INT_DOUBLE_CONCAT_FN (uint16)
134 OCTAVE_INT_DOUBLE_CONCAT_FN (uint32)
135 OCTAVE_INT_DOUBLE_CONCAT_FN (uint64)
136
137 OCTAVE_DOUBLE_INT_CONCAT_FN (int8)
138 OCTAVE_DOUBLE_INT_CONCAT_FN (int16)
139 OCTAVE_DOUBLE_INT_CONCAT_FN (int32)
140 OCTAVE_DOUBLE_INT_CONCAT_FN (int64)
141
142 OCTAVE_DOUBLE_INT_CONCAT_FN (uint8)
143 OCTAVE_DOUBLE_INT_CONCAT_FN (uint16)
144 OCTAVE_DOUBLE_INT_CONCAT_FN (uint32)
145 OCTAVE_DOUBLE_INT_CONCAT_FN (uint64)
146
147 OCTAVE_INT_FLOAT_CONCAT_FN (int8)
148 OCTAVE_INT_FLOAT_CONCAT_FN (int16)
149 OCTAVE_INT_FLOAT_CONCAT_FN (int32)
150 OCTAVE_INT_FLOAT_CONCAT_FN (int64)
151
152 OCTAVE_INT_FLOAT_CONCAT_FN (uint8)
153 OCTAVE_INT_FLOAT_CONCAT_FN (uint16)
154 OCTAVE_INT_FLOAT_CONCAT_FN (uint32)
155 OCTAVE_INT_FLOAT_CONCAT_FN (uint64)
156
157 OCTAVE_FLOAT_INT_CONCAT_FN (int8)
158 OCTAVE_FLOAT_INT_CONCAT_FN (int16)
159 OCTAVE_FLOAT_INT_CONCAT_FN (int32)
160 OCTAVE_FLOAT_INT_CONCAT_FN (int64)
161
162 OCTAVE_FLOAT_INT_CONCAT_FN (uint8)
163 OCTAVE_FLOAT_INT_CONCAT_FN (uint16)
164 OCTAVE_FLOAT_INT_CONCAT_FN (uint32)
165 OCTAVE_FLOAT_INT_CONCAT_FN (uint64)
166
167 OCTAVE_INT_CHAR_CONCAT_FN (int8)
168 OCTAVE_INT_CHAR_CONCAT_FN (int16)
169 OCTAVE_INT_CHAR_CONCAT_FN (int32)
170 OCTAVE_INT_CHAR_CONCAT_FN (int64)
171
172 OCTAVE_INT_CHAR_CONCAT_FN (uint8)
173 OCTAVE_INT_CHAR_CONCAT_FN (uint16)
174 OCTAVE_INT_CHAR_CONCAT_FN (uint32)
175 OCTAVE_INT_CHAR_CONCAT_FN (uint64)
176
177 OCTAVE_CHAR_INT_CONCAT_FN (int8)
178 OCTAVE_CHAR_INT_CONCAT_FN (int16)
179 OCTAVE_CHAR_INT_CONCAT_FN (int32)
180 OCTAVE_CHAR_INT_CONCAT_FN (int64)
181
182 OCTAVE_CHAR_INT_CONCAT_FN (uint8)
183 OCTAVE_CHAR_INT_CONCAT_FN (uint16)
184 OCTAVE_CHAR_INT_CONCAT_FN (uint32)
185 OCTAVE_CHAR_INT_CONCAT_FN (uint64)
186
187 void
188 install_int_concat_ops (octave::type_info& ti)
189 {
190 OCTAVE_INSTALL_CONCAT_FN2 (int8, int16);
191 OCTAVE_INSTALL_CONCAT_FN2 (int8, int32);
192 OCTAVE_INSTALL_CONCAT_FN2 (int8, int64);
193
194 OCTAVE_INSTALL_CONCAT_FN2 (int8, uint8);
195 OCTAVE_INSTALL_CONCAT_FN2 (int8, uint16);
196 OCTAVE_INSTALL_CONCAT_FN2 (int8, uint32);
197 OCTAVE_INSTALL_CONCAT_FN2 (int8, uint64);
198
199 OCTAVE_INSTALL_CONCAT_FN2 (int16, int8);
200 OCTAVE_INSTALL_CONCAT_FN2 (int16, int32);
201 OCTAVE_INSTALL_CONCAT_FN2 (int16, int64);
202
203 OCTAVE_INSTALL_CONCAT_FN2 (int16, uint8);
204 OCTAVE_INSTALL_CONCAT_FN2 (int16, uint16);
205 OCTAVE_INSTALL_CONCAT_FN2 (int16, uint32);
206 OCTAVE_INSTALL_CONCAT_FN2 (int16, uint64);
207
208 OCTAVE_INSTALL_CONCAT_FN2 (int32, int8);
209 OCTAVE_INSTALL_CONCAT_FN2 (int32, int16);
210 OCTAVE_INSTALL_CONCAT_FN2 (int32, int64);
211
212 OCTAVE_INSTALL_CONCAT_FN2 (int32, uint8);
213 OCTAVE_INSTALL_CONCAT_FN2 (int32, uint16);
214 OCTAVE_INSTALL_CONCAT_FN2 (int32, uint32);
215 OCTAVE_INSTALL_CONCAT_FN2 (int32, uint64);
216
217 OCTAVE_INSTALL_CONCAT_FN2 (int64, int8);
218 OCTAVE_INSTALL_CONCAT_FN2 (int64, int16);
219 OCTAVE_INSTALL_CONCAT_FN2 (int64, int32);
220
221 OCTAVE_INSTALL_CONCAT_FN2 (int64, uint8);
222 OCTAVE_INSTALL_CONCAT_FN2 (int64, uint16);
223 OCTAVE_INSTALL_CONCAT_FN2 (int64, uint32);
224 OCTAVE_INSTALL_CONCAT_FN2 (int64, uint64);
225
226 OCTAVE_INSTALL_CONCAT_FN2 (uint8, int8);
227 OCTAVE_INSTALL_CONCAT_FN2 (uint8, int16);
228 OCTAVE_INSTALL_CONCAT_FN2 (uint8, int32);
229 OCTAVE_INSTALL_CONCAT_FN2 (uint8, int64);
230
231 OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint16);
232 OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint32);
233 OCTAVE_INSTALL_CONCAT_FN2 (uint8, uint64);
234
235 OCTAVE_INSTALL_CONCAT_FN2 (uint16, int8);
236 OCTAVE_INSTALL_CONCAT_FN2 (uint16, int16);
237 OCTAVE_INSTALL_CONCAT_FN2 (uint16, int32);
238 OCTAVE_INSTALL_CONCAT_FN2 (uint16, int64);
239
240 OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint8);
241 OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint32);
242 OCTAVE_INSTALL_CONCAT_FN2 (uint16, uint64);
243
244 OCTAVE_INSTALL_CONCAT_FN2 (uint32, int8);
245 OCTAVE_INSTALL_CONCAT_FN2 (uint32, int16);
246 OCTAVE_INSTALL_CONCAT_FN2 (uint32, int32);
247 OCTAVE_INSTALL_CONCAT_FN2 (uint32, int64);
248
249 OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint8);
250 OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint16);
251 OCTAVE_INSTALL_CONCAT_FN2 (uint32, uint64);
252
253 OCTAVE_INSTALL_CONCAT_FN2 (uint64, int8);
254 OCTAVE_INSTALL_CONCAT_FN2 (uint64, int16);
255 OCTAVE_INSTALL_CONCAT_FN2 (uint64, int32);
256 OCTAVE_INSTALL_CONCAT_FN2 (uint64, int64);
257
258 OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint8);
259 OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint16);
260 OCTAVE_INSTALL_CONCAT_FN2 (uint64, uint32);
261
262 OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int8);
263 OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int16);
264 OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int32);
265 OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (int64);
266
267 OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint8);
268 OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint16);
269 OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint32);
270 OCTAVE_INSTALL_INT_DOUBLE_CONCAT_FN (uint64);
271
272 OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int8);
273 OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int16);
274 OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int32);
275 OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (int64);
276
277 OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint8);
278 OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint16);
279 OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint32);
280 OCTAVE_INSTALL_DOUBLE_INT_CONCAT_FN (uint64);
281
282 OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int8);
283 OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int16);
284 OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int32);
285 OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (int64);
286
287 OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint8);
288 OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint16);
289 OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint32);
290 OCTAVE_INSTALL_INT_FLOAT_CONCAT_FN (uint64);
291
292 OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int8);
293 OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int16);
294 OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int32);
295 OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (int64);
296
297 OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint8);
298 OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint16);
299 OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint32);
300 OCTAVE_INSTALL_FLOAT_INT_CONCAT_FN (uint64);
301
302 OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int8);
303 OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int16);
304 OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int32);
305 OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (int64);
306
307 OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint8);
308 OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint16);
309 OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint32);
310 OCTAVE_INSTALL_INT_CHAR_CONCAT_FN (uint64);
311
312 OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int8);
313 OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int16);
314 OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int32);
315 OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (int64);
316
317 OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint8);
318 OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint16);
319 OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint32);
320 OCTAVE_INSTALL_CHAR_INT_CONCAT_FN (uint64);
321 }
322