1 |
282 |
jeremybenn |
/* This is a software fixed-point library.
|
2 |
|
|
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
3 |
|
|
|
4 |
|
|
This file is part of GCC.
|
5 |
|
|
|
6 |
|
|
GCC is free software; you can redistribute it and/or modify it under
|
7 |
|
|
the terms of the GNU General Public License as published by the Free
|
8 |
|
|
Software Foundation; either version 3, or (at your option) any later
|
9 |
|
|
version.
|
10 |
|
|
|
11 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
12 |
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14 |
|
|
for more details.
|
15 |
|
|
|
16 |
|
|
Under Section 7 of GPL version 3, you are granted additional
|
17 |
|
|
permissions described in the GCC Runtime Library Exception, version
|
18 |
|
|
3.1, as published by the Free Software Foundation.
|
19 |
|
|
|
20 |
|
|
You should have received a copy of the GNU General Public License and
|
21 |
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
22 |
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
23 |
|
|
<http://www.gnu.org/licenses/>. */
|
24 |
|
|
|
25 |
|
|
#ifndef _FIXED_BIT_H
|
26 |
|
|
#define _FIXED_BIT_H
|
27 |
|
|
|
28 |
|
|
/* To use this file we need to define one of the following:
|
29 |
|
|
QQ_MODE, UQQ_MODE, HQ_MODE, UHQ_MODE, SQ_MODE, USQ_MODE, DQ_MODE, UDQ_MODE,
|
30 |
|
|
TQ_MODE, UTQ_MODE, HA_MODE, UHA_MODE, SA_MODE, USA_MODE, DA_MODE, UDA_MODE,
|
31 |
|
|
TA_MODE, UTA_MODE.
|
32 |
|
|
Then, all operators for this machine mode will be created.
|
33 |
|
|
|
34 |
|
|
Or, we need to define FROM_* TO_* for conversions from one mode to another
|
35 |
|
|
mode. The mode could be one of the following:
|
36 |
|
|
Fract: QQ, UQQ, HQ, UHQ, SQ, USQ, DQ, UDQ, TQ, UTQ
|
37 |
|
|
Accum: HA, UHA, SA, USA, DA, UDA, TA, UTA
|
38 |
|
|
Signed integer: QI, HI, SI, DI, TI
|
39 |
|
|
Unsigned integer: UQI, UHI, USI, UDI, UTI
|
40 |
|
|
Floating-point: SF, DF
|
41 |
|
|
Ex: If we define FROM_QQ and TO_SI, the conversion from QQ to SI is
|
42 |
|
|
generated. */
|
43 |
|
|
|
44 |
|
|
/* Permit the tm.h file to select the endianness to use just for this
|
45 |
|
|
file. This is used when the endianness is determined when the
|
46 |
|
|
compiler is run. */
|
47 |
|
|
|
48 |
|
|
#ifndef LIBGCC2_WORDS_BIG_ENDIAN
|
49 |
|
|
#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
|
50 |
|
|
#endif
|
51 |
|
|
|
52 |
|
|
#ifndef LIBGCC2_DOUBLE_TYPE_SIZE
|
53 |
|
|
#define LIBGCC2_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
|
54 |
|
|
#endif
|
55 |
|
|
#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
|
56 |
|
|
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
|
57 |
|
|
#endif
|
58 |
|
|
|
59 |
|
|
#ifndef LIBGCC2_HAS_SF_MODE
|
60 |
|
|
#define LIBGCC2_HAS_SF_MODE (BITS_PER_UNIT == 8)
|
61 |
|
|
#endif
|
62 |
|
|
|
63 |
|
|
#ifndef LIBGCC2_HAS_DF_MODE
|
64 |
|
|
#define LIBGCC2_HAS_DF_MODE \
|
65 |
|
|
(BITS_PER_UNIT == 8 \
|
66 |
|
|
&& (LIBGCC2_DOUBLE_TYPE_SIZE == 64 \
|
67 |
|
|
|| LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64))
|
68 |
|
|
#endif
|
69 |
|
|
|
70 |
|
|
typedef int QItype __attribute__ ((mode (QI)));
|
71 |
|
|
typedef unsigned int UQItype __attribute__ ((mode (QI)));
|
72 |
|
|
typedef int HItype __attribute__ ((mode (HI)));
|
73 |
|
|
typedef unsigned int UHItype __attribute__ ((mode (HI)));
|
74 |
|
|
typedef _Fract QQtype __attribute__ ((mode (QQ)));
|
75 |
|
|
typedef unsigned _Fract UQQtype __attribute__ ((mode (UQQ)));
|
76 |
|
|
typedef _Fract HQtype __attribute__ ((mode (HQ)));
|
77 |
|
|
typedef unsigned _Fract UHQtype __attribute__ ((mode (UHQ)));
|
78 |
|
|
typedef _Fract HAtype __attribute__ ((mode (HA)));
|
79 |
|
|
typedef unsigned _Fract UHAtype __attribute__ ((mode (UHA)));
|
80 |
|
|
#define HAVE_QQ 1
|
81 |
|
|
#define HAVE_UQQ 1
|
82 |
|
|
#define HAVE_HQ 1
|
83 |
|
|
#define HAVE_UHQ 1
|
84 |
|
|
#define HAVE_HA 1
|
85 |
|
|
#define HAVE_UHA 1
|
86 |
|
|
#define HAVE_QI 1
|
87 |
|
|
#define HAVE_UQI 1
|
88 |
|
|
#define HAVE_HI 1
|
89 |
|
|
#define HAVE_UHI 1
|
90 |
|
|
#if MIN_UNITS_PER_WORD > 1
|
91 |
|
|
/* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1. */
|
92 |
|
|
typedef int SItype __attribute__ ((mode (SI)));
|
93 |
|
|
typedef unsigned int USItype __attribute__ ((mode (SI)));
|
94 |
|
|
typedef _Fract SQtype __attribute__ ((mode (SQ)));
|
95 |
|
|
typedef unsigned _Fract USQtype __attribute__ ((mode (USQ)));
|
96 |
|
|
typedef _Fract SAtype __attribute__ ((mode (SA)));
|
97 |
|
|
typedef unsigned _Fract USAtype __attribute__ ((mode (USA)));
|
98 |
|
|
#define HAVE_SQ 1
|
99 |
|
|
#define HAVE_USQ 1
|
100 |
|
|
#define HAVE_SA 1
|
101 |
|
|
#define HAVE_USA 1
|
102 |
|
|
#define HAVE_SI 1
|
103 |
|
|
#define HAVE_USI 1
|
104 |
|
|
#if LONG_LONG_TYPE_SIZE > 32
|
105 |
|
|
/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2. */
|
106 |
|
|
typedef int DItype __attribute__ ((mode (DI)));
|
107 |
|
|
typedef unsigned int UDItype __attribute__ ((mode (DI)));
|
108 |
|
|
typedef _Fract DQtype __attribute__ ((mode (DQ)));
|
109 |
|
|
typedef unsigned _Fract UDQtype __attribute__ ((mode (UDQ)));
|
110 |
|
|
typedef _Fract DAtype __attribute__ ((mode (DA)));
|
111 |
|
|
typedef unsigned _Fract UDAtype __attribute__ ((mode (UDA)));
|
112 |
|
|
#define HAVE_DQ 1
|
113 |
|
|
#define HAVE_UDQ 1
|
114 |
|
|
#define HAVE_DA 1
|
115 |
|
|
#define HAVE_UDA 1
|
116 |
|
|
#define HAVE_DI 1
|
117 |
|
|
#define HAVE_UDI 1
|
118 |
|
|
#if MIN_UNITS_PER_WORD > 4
|
119 |
|
|
/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4. */
|
120 |
|
|
typedef int TItype __attribute__ ((mode (TI)));
|
121 |
|
|
typedef unsigned int UTItype __attribute__ ((mode (TI)));
|
122 |
|
|
typedef _Fract TQtype __attribute__ ((mode (TQ)));
|
123 |
|
|
typedef unsigned _Fract UTQtype __attribute__ ((mode (UTQ)));
|
124 |
|
|
typedef _Fract TAtype __attribute__ ((mode (TA)));
|
125 |
|
|
typedef unsigned _Fract UTAtype __attribute__ ((mode (UTA)));
|
126 |
|
|
#define HAVE_TQ 1
|
127 |
|
|
#define HAVE_UTQ 1
|
128 |
|
|
#define HAVE_TA 1
|
129 |
|
|
#define HAVE_UTA 1
|
130 |
|
|
#define HAVE_TI 1
|
131 |
|
|
#define HAVE_UTI 1
|
132 |
|
|
#endif
|
133 |
|
|
#endif
|
134 |
|
|
#endif
|
135 |
|
|
|
136 |
|
|
#if LIBGCC2_HAS_SF_MODE
|
137 |
|
|
typedef float SFtype __attribute__ ((mode (SF)));
|
138 |
|
|
#define HAVE_SF 1
|
139 |
|
|
#endif
|
140 |
|
|
#if LIBGCC2_HAS_DF_MODE
|
141 |
|
|
typedef float DFtype __attribute__ ((mode (DF)));
|
142 |
|
|
#define HAVE_DF 1
|
143 |
|
|
#endif
|
144 |
|
|
|
145 |
|
|
typedef int word_type __attribute__ ((mode (__word__)));
|
146 |
|
|
|
147 |
|
|
/* Based on modes, we create many defines. */
|
148 |
|
|
|
149 |
|
|
#if defined (QQ_MODE) && (HAVE_QQ == 1)
|
150 |
|
|
#define FIXED_SIZE 1 /* in bytes. */
|
151 |
|
|
#define INT_C_TYPE QItype
|
152 |
|
|
#define UINT_C_TYPE UQItype
|
153 |
|
|
#define DINT_C_TYPE HItype
|
154 |
|
|
#define DUINT_C_TYPE UHItype
|
155 |
|
|
#define MODE_NAME QQ
|
156 |
|
|
#define MODE_NAME_S qq
|
157 |
|
|
#define MODE_UNSIGNED 0
|
158 |
|
|
#endif
|
159 |
|
|
|
160 |
|
|
#if defined (UQQ_MODE) && (HAVE_UQQ == 1)
|
161 |
|
|
#define FIXED_SIZE 1 /* in bytes. */
|
162 |
|
|
#define INT_C_TYPE UQItype
|
163 |
|
|
#define UINT_C_TYPE UQItype
|
164 |
|
|
#define DINT_C_TYPE UHItype
|
165 |
|
|
#define DUINT_C_TYPE UHItype
|
166 |
|
|
#define MODE_NAME UQQ
|
167 |
|
|
#define MODE_NAME_S uqq
|
168 |
|
|
#define MODE_UNSIGNED 1
|
169 |
|
|
#endif
|
170 |
|
|
|
171 |
|
|
#if defined (HQ_MODE) && (HAVE_HQ == 1)
|
172 |
|
|
#define FIXED_SIZE 2 /* in bytes. */
|
173 |
|
|
#define INT_C_TYPE HItype
|
174 |
|
|
#define UINT_C_TYPE UHItype
|
175 |
|
|
|
176 |
|
|
#if HAVE_SI == 1
|
177 |
|
|
#define DINT_C_TYPE SItype
|
178 |
|
|
#define DUINT_C_TYPE USItype
|
179 |
|
|
#else
|
180 |
|
|
#define HINT_C_TYPE QItype
|
181 |
|
|
#define HUINT_C_TYPE UQItype
|
182 |
|
|
#endif
|
183 |
|
|
|
184 |
|
|
#define MODE_NAME HQ
|
185 |
|
|
#define MODE_NAME_S hq
|
186 |
|
|
#define MODE_UNSIGNED 0
|
187 |
|
|
#endif
|
188 |
|
|
|
189 |
|
|
#if defined (UHQ_MODE) && (HAVE_UHQ == 1)
|
190 |
|
|
#define FIXED_SIZE 2 /* in bytes. */
|
191 |
|
|
#define INT_C_TYPE UHItype
|
192 |
|
|
#define UINT_C_TYPE UHItype
|
193 |
|
|
|
194 |
|
|
#if HAVE_SI == 1
|
195 |
|
|
#define DINT_C_TYPE USItype
|
196 |
|
|
#define DUINT_C_TYPE USItype
|
197 |
|
|
#else
|
198 |
|
|
#define HINT_C_TYPE UQItype
|
199 |
|
|
#define HUINT_C_TYPE UQItype
|
200 |
|
|
#endif
|
201 |
|
|
|
202 |
|
|
#define MODE_NAME UHQ
|
203 |
|
|
#define MODE_NAME_S uhq
|
204 |
|
|
#define MODE_UNSIGNED 1
|
205 |
|
|
#endif
|
206 |
|
|
|
207 |
|
|
#if defined (SQ_MODE) && (HAVE_SQ == 1)
|
208 |
|
|
#define FIXED_SIZE 4 /* in bytes. */
|
209 |
|
|
#define INT_C_TYPE SItype
|
210 |
|
|
#define UINT_C_TYPE USItype
|
211 |
|
|
|
212 |
|
|
#if HAVE_DI == 1
|
213 |
|
|
#define DINT_C_TYPE DItype
|
214 |
|
|
#define DUINT_C_TYPE UDItype
|
215 |
|
|
#else
|
216 |
|
|
#define HINT_C_TYPE HItype
|
217 |
|
|
#define HUINT_C_TYPE UHItype
|
218 |
|
|
#endif
|
219 |
|
|
|
220 |
|
|
#define MODE_NAME SQ
|
221 |
|
|
#define MODE_NAME_S sq
|
222 |
|
|
#define MODE_UNSIGNED 0
|
223 |
|
|
#endif
|
224 |
|
|
|
225 |
|
|
#if defined (USQ_MODE) && (HAVE_USQ == 1)
|
226 |
|
|
#define FIXED_SIZE 4 /* in bytes. */
|
227 |
|
|
#define INT_C_TYPE USItype
|
228 |
|
|
#define UINT_C_TYPE USItype
|
229 |
|
|
|
230 |
|
|
#if HAVE_DI == 1
|
231 |
|
|
#define DINT_C_TYPE UDItype
|
232 |
|
|
#define DUINT_C_TYPE UDItype
|
233 |
|
|
#else
|
234 |
|
|
#define HINT_C_TYPE UHItype
|
235 |
|
|
#define HUINT_C_TYPE UHItype
|
236 |
|
|
#endif
|
237 |
|
|
|
238 |
|
|
#define MODE_NAME USQ
|
239 |
|
|
#define MODE_NAME_S usq
|
240 |
|
|
#define MODE_UNSIGNED 1
|
241 |
|
|
#endif
|
242 |
|
|
|
243 |
|
|
#if defined (DQ_MODE) && (HAVE_DQ == 1)
|
244 |
|
|
#define FIXED_SIZE 8 /* in bytes. */
|
245 |
|
|
#define INT_C_TYPE DItype
|
246 |
|
|
#define UINT_C_TYPE UDItype
|
247 |
|
|
|
248 |
|
|
#if HAVE_TI == 1
|
249 |
|
|
#define DINT_C_TYPE TItype
|
250 |
|
|
#define DUINT_C_TYPE UTItype
|
251 |
|
|
#else
|
252 |
|
|
#define HINT_C_TYPE SItype
|
253 |
|
|
#define HUINT_C_TYPE USItype
|
254 |
|
|
#endif
|
255 |
|
|
|
256 |
|
|
#define MODE_NAME DQ
|
257 |
|
|
#define MODE_NAME_S dq
|
258 |
|
|
#define MODE_UNSIGNED 0
|
259 |
|
|
#endif
|
260 |
|
|
|
261 |
|
|
#if defined (UDQ_MODE) && (HAVE_UDQ == 1)
|
262 |
|
|
#define FIXED_SIZE 8 /* in bytes. */
|
263 |
|
|
#define INT_C_TYPE UDItype
|
264 |
|
|
#define UINT_C_TYPE UDItype
|
265 |
|
|
|
266 |
|
|
#if HAVE_TI == 1
|
267 |
|
|
#define DINT_C_TYPE UTItype
|
268 |
|
|
#define DUINT_C_TYPE UTItype
|
269 |
|
|
#else
|
270 |
|
|
#define HINT_C_TYPE USItype
|
271 |
|
|
#define HUINT_C_TYPE USItype
|
272 |
|
|
#endif
|
273 |
|
|
|
274 |
|
|
#define MODE_NAME UDQ
|
275 |
|
|
#define MODE_NAME_S udq
|
276 |
|
|
#define MODE_UNSIGNED 1
|
277 |
|
|
#endif
|
278 |
|
|
|
279 |
|
|
#if defined (TQ_MODE) && (HAVE_TQ == 1)
|
280 |
|
|
#define FIXED_SIZE 16 /* in bytes. */
|
281 |
|
|
#define INT_C_TYPE TItype
|
282 |
|
|
#define UINT_C_TYPE UTItype
|
283 |
|
|
#define HINT_C_TYPE DItype
|
284 |
|
|
#define HUINT_C_TYPE UDItype
|
285 |
|
|
#define MODE_NAME TQ
|
286 |
|
|
#define MODE_NAME_S tq
|
287 |
|
|
#define MODE_UNSIGNED 0
|
288 |
|
|
#endif
|
289 |
|
|
|
290 |
|
|
#if defined (UTQ_MODE) && (HAVE_UTQ == 1)
|
291 |
|
|
#define FIXED_SIZE 16 /* in bytes. */
|
292 |
|
|
#define INT_C_TYPE UTItype
|
293 |
|
|
#define UINT_C_TYPE UTItype
|
294 |
|
|
#define HINT_C_TYPE UDItype
|
295 |
|
|
#define HUINT_C_TYPE UDItype
|
296 |
|
|
#define MODE_NAME UTQ
|
297 |
|
|
#define MODE_NAME_S utq
|
298 |
|
|
#define MODE_UNSIGNED 1
|
299 |
|
|
#endif
|
300 |
|
|
|
301 |
|
|
#if defined (HA_MODE) && (HAVE_HA == 1)
|
302 |
|
|
#define FIXED_SIZE 2 /* in bytes. */
|
303 |
|
|
#define INT_C_TYPE HItype
|
304 |
|
|
#define UINT_C_TYPE UHItype
|
305 |
|
|
|
306 |
|
|
#if HAVE_SI == 1
|
307 |
|
|
#define DINT_C_TYPE SItype
|
308 |
|
|
#define DUINT_C_TYPE USItype
|
309 |
|
|
#else
|
310 |
|
|
#define HINT_C_TYPE QItype
|
311 |
|
|
#define HUINT_C_TYPE UQItype
|
312 |
|
|
#endif
|
313 |
|
|
|
314 |
|
|
#define MODE_NAME HA
|
315 |
|
|
#define MODE_NAME_S ha
|
316 |
|
|
#define MODE_UNSIGNED 0
|
317 |
|
|
#endif
|
318 |
|
|
|
319 |
|
|
#if defined (UHA_MODE) && (HAVE_UHA == 1)
|
320 |
|
|
#define FIXED_SIZE 2 /* in bytes. */
|
321 |
|
|
#define INT_C_TYPE UHItype
|
322 |
|
|
#define UINT_C_TYPE UHItype
|
323 |
|
|
|
324 |
|
|
#if HAVE_SI == 1
|
325 |
|
|
#define DINT_C_TYPE USItype
|
326 |
|
|
#define DUINT_C_TYPE USItype
|
327 |
|
|
#else
|
328 |
|
|
#define HINT_C_TYPE UQItype
|
329 |
|
|
#define HUINT_C_TYPE UQItype
|
330 |
|
|
#endif
|
331 |
|
|
|
332 |
|
|
#define MODE_NAME UHA
|
333 |
|
|
#define MODE_NAME_S uha
|
334 |
|
|
#define MODE_UNSIGNED 1
|
335 |
|
|
#endif
|
336 |
|
|
|
337 |
|
|
#if defined (SA_MODE) && (HAVE_SA == 1)
|
338 |
|
|
#define FIXED_SIZE 4 /* in bytes. */
|
339 |
|
|
#define INT_C_TYPE SItype
|
340 |
|
|
#define UINT_C_TYPE USItype
|
341 |
|
|
|
342 |
|
|
#if HAVE_DI == 1
|
343 |
|
|
#define DINT_C_TYPE DItype
|
344 |
|
|
#define DUINT_C_TYPE UDItype
|
345 |
|
|
#else
|
346 |
|
|
#define HINT_C_TYPE HItype
|
347 |
|
|
#define HUINT_C_TYPE UHItype
|
348 |
|
|
#endif
|
349 |
|
|
|
350 |
|
|
#define MODE_NAME SA
|
351 |
|
|
#define MODE_NAME_S sa
|
352 |
|
|
#define MODE_UNSIGNED 0
|
353 |
|
|
#endif
|
354 |
|
|
|
355 |
|
|
#if defined (USA_MODE) && (HAVE_USA == 1)
|
356 |
|
|
#define FIXED_SIZE 4 /* in bytes. */
|
357 |
|
|
#define INT_C_TYPE USItype
|
358 |
|
|
#define UINT_C_TYPE USItype
|
359 |
|
|
|
360 |
|
|
#if HAVE_DI == 1
|
361 |
|
|
#define DINT_C_TYPE UDItype
|
362 |
|
|
#define DUINT_C_TYPE UDItype
|
363 |
|
|
#else
|
364 |
|
|
#define HINT_C_TYPE UHItype
|
365 |
|
|
#define HUINT_C_TYPE UHItype
|
366 |
|
|
#endif
|
367 |
|
|
|
368 |
|
|
#define MODE_NAME USA
|
369 |
|
|
#define MODE_NAME_S usa
|
370 |
|
|
#define MODE_UNSIGNED 1
|
371 |
|
|
#endif
|
372 |
|
|
|
373 |
|
|
#if defined (DA_MODE) && (HAVE_DA == 1)
|
374 |
|
|
#define FIXED_SIZE 8 /* in bytes. */
|
375 |
|
|
#define INT_C_TYPE DItype
|
376 |
|
|
#define UINT_C_TYPE UDItype
|
377 |
|
|
|
378 |
|
|
#if HAVE_TI == 1
|
379 |
|
|
#define DINT_C_TYPE TItype
|
380 |
|
|
#define DUINT_C_TYPE UTItype
|
381 |
|
|
#else
|
382 |
|
|
#define HINT_C_TYPE SItype
|
383 |
|
|
#define HUINT_C_TYPE USItype
|
384 |
|
|
#endif
|
385 |
|
|
|
386 |
|
|
#define MODE_NAME DA
|
387 |
|
|
#define MODE_NAME_S da
|
388 |
|
|
#define MODE_UNSIGNED 0
|
389 |
|
|
#endif
|
390 |
|
|
|
391 |
|
|
#if defined (UDA_MODE) && (HAVE_UDA == 1)
|
392 |
|
|
#define FIXED_SIZE 8 /* in bytes. */
|
393 |
|
|
#define INT_C_TYPE UDItype
|
394 |
|
|
#define UINT_C_TYPE UDItype
|
395 |
|
|
|
396 |
|
|
#if HAVE_TI == 1
|
397 |
|
|
#define DINT_C_TYPE UTItype
|
398 |
|
|
#define DUINT_C_TYPE UTItype
|
399 |
|
|
#else
|
400 |
|
|
#define HINT_C_TYPE USItype
|
401 |
|
|
#define HUINT_C_TYPE USItype
|
402 |
|
|
#endif
|
403 |
|
|
|
404 |
|
|
#define MODE_NAME UDA
|
405 |
|
|
#define MODE_NAME_S uda
|
406 |
|
|
#define MODE_UNSIGNED 1
|
407 |
|
|
#endif
|
408 |
|
|
|
409 |
|
|
#if defined (TA_MODE) && (HAVE_TA == 1)
|
410 |
|
|
#define FIXED_SIZE 16 /* in bytes. */
|
411 |
|
|
#define INT_C_TYPE TItype
|
412 |
|
|
#define UINT_C_TYPE UTItype
|
413 |
|
|
#define HINT_C_TYPE DItype
|
414 |
|
|
#define HUINT_C_TYPE UDItype
|
415 |
|
|
#define MODE_NAME TA
|
416 |
|
|
#define MODE_NAME_S ta
|
417 |
|
|
#define MODE_UNSIGNED 0
|
418 |
|
|
#endif
|
419 |
|
|
|
420 |
|
|
#if defined (UTA_MODE) && (HAVE_UTA == 1)
|
421 |
|
|
#define FIXED_SIZE 16 /* in bytes. */
|
422 |
|
|
#define INT_C_TYPE UTItype
|
423 |
|
|
#define UINT_C_TYPE UTItype
|
424 |
|
|
#define HINT_C_TYPE UDItype
|
425 |
|
|
#define HUINT_C_TYPE UDItype
|
426 |
|
|
#define MODE_NAME UTA
|
427 |
|
|
#define MODE_NAME_S uta
|
428 |
|
|
#define MODE_UNSIGNED 1
|
429 |
|
|
#endif
|
430 |
|
|
|
431 |
|
|
/* The following defines are based on the previous defines. */
|
432 |
|
|
|
433 |
|
|
#if defined (HINT_C_TYPE)
|
434 |
|
|
#if LIBGCC2_WORDS_BIG_ENDIAN
|
435 |
|
|
struct INTstruct {HINT_C_TYPE high, low;};
|
436 |
|
|
#else
|
437 |
|
|
struct INTstruct {HINT_C_TYPE low, high;};
|
438 |
|
|
#endif
|
439 |
|
|
|
440 |
|
|
typedef union
|
441 |
|
|
{
|
442 |
|
|
struct INTstruct s;
|
443 |
|
|
INT_C_TYPE ll;
|
444 |
|
|
} INTunion;
|
445 |
|
|
#endif
|
446 |
|
|
|
447 |
|
|
#define FIXED_WIDTH (FIXED_SIZE * BITS_PER_UNIT) /* in bits. */
|
448 |
|
|
#define FIXED_C_TYPE1(NAME) NAME ## type
|
449 |
|
|
#define FIXED_C_TYPE2(NAME) FIXED_C_TYPE1(NAME)
|
450 |
|
|
#define FIXED_C_TYPE FIXED_C_TYPE2(MODE_NAME)
|
451 |
|
|
#define FBITS1(NAME) __ ## NAME ## _FBIT__
|
452 |
|
|
#define FBITS2(NAME) FBITS1(NAME)
|
453 |
|
|
#define FBITS FBITS2(MODE_NAME)
|
454 |
|
|
#define IBITS1(NAME) __ ## NAME ## _IBIT__
|
455 |
|
|
#define IBITS2(NAME) IBITS1(NAME)
|
456 |
|
|
#define IBITS IBITS2(MODE_NAME)
|
457 |
|
|
#define I_F_BITS (FBITS + IBITS)
|
458 |
|
|
|
459 |
|
|
#define FIXED_OP(OP,MODE,NUM) OP ## MODE ## NUM
|
460 |
|
|
|
461 |
|
|
#define FIXED_SATURATE1_TEMP(NAME) FIXED_OP(__saturate1,NAME,)
|
462 |
|
|
#define FIXED_SATURATE2_TEMP(NAME) FIXED_OP(__saturate2,NAME,)
|
463 |
|
|
#define FIXED_MULHELPER_TEMP(NAME) FIXED_OP(__mulhelper,NAME,)
|
464 |
|
|
#define FIXED_DIVHELPER_TEMP(NAME) FIXED_OP(__divhelper,NAME,)
|
465 |
|
|
#define FIXED_ASHLHELPER_TEMP(NAME) FIXED_OP(__ashlhelper,NAME,)
|
466 |
|
|
#define FIXED_ADD_TEMP(NAME) FIXED_OP(__add,NAME,3)
|
467 |
|
|
#define FIXED_SSADD_TEMP(NAME) FIXED_OP(__ssadd,NAME,3)
|
468 |
|
|
#define FIXED_USADD_TEMP(NAME) FIXED_OP(__usadd,NAME,3)
|
469 |
|
|
#define FIXED_SUB_TEMP(NAME) FIXED_OP(__sub,NAME,3)
|
470 |
|
|
#define FIXED_SSSUB_TEMP(NAME) FIXED_OP(__sssub,NAME,3)
|
471 |
|
|
#define FIXED_USSUB_TEMP(NAME) FIXED_OP(__ussub,NAME,3)
|
472 |
|
|
#define FIXED_MUL_TEMP(NAME) FIXED_OP(__mul,NAME,3)
|
473 |
|
|
#define FIXED_SSMUL_TEMP(NAME) FIXED_OP(__ssmul,NAME,3)
|
474 |
|
|
#define FIXED_USMUL_TEMP(NAME) FIXED_OP(__usmul,NAME,3)
|
475 |
|
|
#define FIXED_DIV_TEMP(NAME) FIXED_OP(__div,NAME,3)
|
476 |
|
|
#define FIXED_UDIV_TEMP(NAME) FIXED_OP(__udiv,NAME,3)
|
477 |
|
|
#define FIXED_SSDIV_TEMP(NAME) FIXED_OP(__ssdiv,NAME,3)
|
478 |
|
|
#define FIXED_USDIV_TEMP(NAME) FIXED_OP(__usdiv,NAME,3)
|
479 |
|
|
#define FIXED_NEG_TEMP(NAME) FIXED_OP(__neg,NAME,2)
|
480 |
|
|
#define FIXED_SSNEG_TEMP(NAME) FIXED_OP(__ssneg,NAME,2)
|
481 |
|
|
#define FIXED_USNEG_TEMP(NAME) FIXED_OP(__usneg,NAME,2)
|
482 |
|
|
#define FIXED_ASHL_TEMP(NAME) FIXED_OP(__ashl,NAME,3)
|
483 |
|
|
#define FIXED_ASHR_TEMP(NAME) FIXED_OP(__ashr,NAME,3)
|
484 |
|
|
#define FIXED_LSHR_TEMP(NAME) FIXED_OP(__lshr,NAME,3)
|
485 |
|
|
#define FIXED_SSASHL_TEMP(NAME) FIXED_OP(__ssashl,NAME,3)
|
486 |
|
|
#define FIXED_USASHL_TEMP(NAME) FIXED_OP(__usashl,NAME,3)
|
487 |
|
|
#define FIXED_CMP_TEMP(NAME) FIXED_OP(__cmp,NAME,2)
|
488 |
|
|
|
489 |
|
|
#if defined (MODE_NAME)
|
490 |
|
|
#if defined (DINT_C_TYPE)
|
491 |
|
|
#define FIXED_SATURATE1 FIXED_SATURATE1_TEMP(MODE_NAME_S)
|
492 |
|
|
#else
|
493 |
|
|
#define FIXED_SATURATE2 FIXED_SATURATE2_TEMP(MODE_NAME_S)
|
494 |
|
|
#endif
|
495 |
|
|
#define FIXED_MULHELPER FIXED_MULHELPER_TEMP(MODE_NAME_S)
|
496 |
|
|
#define FIXED_DIVHELPER FIXED_DIVHELPER_TEMP(MODE_NAME_S)
|
497 |
|
|
#define FIXED_ASHLHELPER FIXED_ASHLHELPER_TEMP(MODE_NAME_S)
|
498 |
|
|
#define FIXED_ADD FIXED_ADD_TEMP(MODE_NAME_S)
|
499 |
|
|
#define FIXED_SUB FIXED_SUB_TEMP(MODE_NAME_S)
|
500 |
|
|
#define FIXED_MUL FIXED_MUL_TEMP(MODE_NAME_S)
|
501 |
|
|
#define FIXED_NEG FIXED_NEG_TEMP(MODE_NAME_S)
|
502 |
|
|
#define FIXED_ASHL FIXED_ASHL_TEMP(MODE_NAME_S)
|
503 |
|
|
#define FIXED_CMP FIXED_CMP_TEMP(MODE_NAME_S)
|
504 |
|
|
|
505 |
|
|
/* The following functions are for all fixed-point modes. */
|
506 |
|
|
#if defined (DINT_C_TYPE)
|
507 |
|
|
extern void FIXED_SATURATE1 (DINT_C_TYPE *);
|
508 |
|
|
#else
|
509 |
|
|
extern void FIXED_SATURATE2 (INT_C_TYPE *, INT_C_TYPE *);
|
510 |
|
|
#endif
|
511 |
|
|
extern FIXED_C_TYPE FIXED_MULHELPER (FIXED_C_TYPE, FIXED_C_TYPE, word_type);
|
512 |
|
|
extern FIXED_C_TYPE FIXED_DIVHELPER (FIXED_C_TYPE, FIXED_C_TYPE, word_type);
|
513 |
|
|
extern FIXED_C_TYPE FIXED_ASHLHELPER (FIXED_C_TYPE, word_type, word_type);
|
514 |
|
|
extern FIXED_C_TYPE FIXED_ADD (FIXED_C_TYPE, FIXED_C_TYPE);
|
515 |
|
|
extern FIXED_C_TYPE FIXED_SUB (FIXED_C_TYPE, FIXED_C_TYPE);
|
516 |
|
|
extern FIXED_C_TYPE FIXED_MUL (FIXED_C_TYPE, FIXED_C_TYPE);
|
517 |
|
|
extern FIXED_C_TYPE FIXED_NEG (FIXED_C_TYPE);
|
518 |
|
|
extern FIXED_C_TYPE FIXED_ASHL (FIXED_C_TYPE, word_type);
|
519 |
|
|
extern word_type FIXED_CMP (FIXED_C_TYPE, FIXED_C_TYPE);
|
520 |
|
|
#endif
|
521 |
|
|
|
522 |
|
|
#if MODE_UNSIGNED == 0 /* Signed types. */
|
523 |
|
|
#define PADDING_BITS (FIXED_WIDTH - 1 - I_F_BITS)
|
524 |
|
|
#define NONPADDING_BITS (1 + I_F_BITS)
|
525 |
|
|
|
526 |
|
|
#if defined (MODE_NAME)
|
527 |
|
|
#define FIXED_DIV FIXED_DIV_TEMP(MODE_NAME_S)
|
528 |
|
|
#define FIXED_ASHR FIXED_ASHR_TEMP(MODE_NAME_S)
|
529 |
|
|
#define FIXED_SSADD FIXED_SSADD_TEMP(MODE_NAME_S)
|
530 |
|
|
#define FIXED_SSSUB FIXED_SSSUB_TEMP(MODE_NAME_S)
|
531 |
|
|
#define FIXED_SSMUL FIXED_SSMUL_TEMP(MODE_NAME_S)
|
532 |
|
|
#define FIXED_SSDIV FIXED_SSDIV_TEMP(MODE_NAME_S)
|
533 |
|
|
#define FIXED_SSNEG FIXED_SSNEG_TEMP(MODE_NAME_S)
|
534 |
|
|
#define FIXED_SSASHL FIXED_SSASHL_TEMP(MODE_NAME_S)
|
535 |
|
|
|
536 |
|
|
/* The following functions are for signed fixed-point modes. */
|
537 |
|
|
extern FIXED_C_TYPE FIXED_DIV (FIXED_C_TYPE, FIXED_C_TYPE);
|
538 |
|
|
extern FIXED_C_TYPE FIXED_ASHR (FIXED_C_TYPE, word_type);
|
539 |
|
|
extern FIXED_C_TYPE FIXED_SSADD (FIXED_C_TYPE, FIXED_C_TYPE);
|
540 |
|
|
extern FIXED_C_TYPE FIXED_SSSUB (FIXED_C_TYPE, FIXED_C_TYPE);
|
541 |
|
|
extern FIXED_C_TYPE FIXED_SSMUL (FIXED_C_TYPE, FIXED_C_TYPE);
|
542 |
|
|
extern FIXED_C_TYPE FIXED_SSDIV (FIXED_C_TYPE, FIXED_C_TYPE);
|
543 |
|
|
extern FIXED_C_TYPE FIXED_SSNEG (FIXED_C_TYPE);
|
544 |
|
|
extern FIXED_C_TYPE FIXED_SSASHL (FIXED_C_TYPE, word_type);
|
545 |
|
|
#endif
|
546 |
|
|
|
547 |
|
|
#else /* Unsigned types. */
|
548 |
|
|
#define PADDING_BITS (FIXED_WIDTH - I_F_BITS)
|
549 |
|
|
#define NONPADDING_BITS (I_F_BITS)
|
550 |
|
|
|
551 |
|
|
#if defined (MODE_NAME)
|
552 |
|
|
#define FIXED_UDIV FIXED_UDIV_TEMP(MODE_NAME_S)
|
553 |
|
|
#define FIXED_LSHR FIXED_LSHR_TEMP(MODE_NAME_S)
|
554 |
|
|
#define FIXED_USDIV FIXED_USDIV_TEMP(MODE_NAME_S)
|
555 |
|
|
#define FIXED_USADD FIXED_USADD_TEMP(MODE_NAME_S)
|
556 |
|
|
#define FIXED_USSUB FIXED_USSUB_TEMP(MODE_NAME_S)
|
557 |
|
|
#define FIXED_USMUL FIXED_USMUL_TEMP(MODE_NAME_S)
|
558 |
|
|
#define FIXED_USNEG FIXED_USNEG_TEMP(MODE_NAME_S)
|
559 |
|
|
#define FIXED_USASHL FIXED_USASHL_TEMP(MODE_NAME_S)
|
560 |
|
|
|
561 |
|
|
/* The following functions are for unsigned fixed-point modes. */
|
562 |
|
|
extern FIXED_C_TYPE FIXED_UDIV (FIXED_C_TYPE, FIXED_C_TYPE);
|
563 |
|
|
extern FIXED_C_TYPE FIXED_LSHR (FIXED_C_TYPE, word_type);
|
564 |
|
|
extern FIXED_C_TYPE FIXED_USADD (FIXED_C_TYPE, FIXED_C_TYPE);
|
565 |
|
|
extern FIXED_C_TYPE FIXED_USSUB (FIXED_C_TYPE, FIXED_C_TYPE);
|
566 |
|
|
extern FIXED_C_TYPE FIXED_USMUL (FIXED_C_TYPE, FIXED_C_TYPE);
|
567 |
|
|
extern FIXED_C_TYPE FIXED_USDIV (FIXED_C_TYPE, FIXED_C_TYPE);
|
568 |
|
|
extern FIXED_C_TYPE FIXED_USNEG (FIXED_C_TYPE);
|
569 |
|
|
extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, word_type);
|
570 |
|
|
#endif
|
571 |
|
|
|
572 |
|
|
#endif /* End of testing MODE_UNSIGNED. */
|
573 |
|
|
|
574 |
|
|
/* This define is to check if this mode have any padding bits. */
|
575 |
|
|
#define HAVE_PADDING_BITS (PADDING_BITS > 0)
|
576 |
|
|
|
577 |
|
|
/* ------------------------------------------------------------------------ */
|
578 |
|
|
/* The following defines are for conversions. */
|
579 |
|
|
|
580 |
|
|
#if defined (FROM_QI) && HAVE_QI == 1
|
581 |
|
|
#define FROM_TYPE 1 /* Signed integer. */
|
582 |
|
|
#define FROM_INT_C_TYPE QItype
|
583 |
|
|
#define FROM_SINT_C_TYPE QItype
|
584 |
|
|
#define FROM_UINT_C_TYPE UQItype
|
585 |
|
|
#define FROM_MODE_NAME_S qi
|
586 |
|
|
#define FROM_INT_SIZE 1 /* in bytes. */
|
587 |
|
|
|
588 |
|
|
#elif defined (FROM_HI) && HAVE_HI == 1
|
589 |
|
|
#define FROM_TYPE 1 /* Signed integer. */
|
590 |
|
|
#define FROM_INT_C_TYPE HItype
|
591 |
|
|
#define FROM_SINT_C_TYPE HItype
|
592 |
|
|
#define FROM_UINT_C_TYPE UHItype
|
593 |
|
|
#define FROM_MODE_NAME_S hi
|
594 |
|
|
#define FROM_INT_SIZE 2 /* in bytes. */
|
595 |
|
|
|
596 |
|
|
#elif defined (FROM_SI) && HAVE_SI == 1
|
597 |
|
|
#define FROM_TYPE 1 /* Signed integer. */
|
598 |
|
|
#define FROM_INT_C_TYPE SItype
|
599 |
|
|
#define FROM_SINT_C_TYPE SItype
|
600 |
|
|
#define FROM_UINT_C_TYPE USItype
|
601 |
|
|
#define FROM_MODE_NAME_S si
|
602 |
|
|
#define FROM_INT_SIZE 4 /* in bytes. */
|
603 |
|
|
|
604 |
|
|
#elif defined (FROM_DI) && HAVE_DI == 1
|
605 |
|
|
#define FROM_TYPE 1 /* Signed integer. */
|
606 |
|
|
#define FROM_INT_C_TYPE DItype
|
607 |
|
|
#define FROM_SINT_C_TYPE DItype
|
608 |
|
|
#define FROM_UINT_C_TYPE UDItype
|
609 |
|
|
#define FROM_MODE_NAME_S di
|
610 |
|
|
#define FROM_INT_SIZE 8 /* in bytes. */
|
611 |
|
|
|
612 |
|
|
#elif defined (FROM_TI) && HAVE_TI == 1
|
613 |
|
|
#define FROM_TYPE 1 /* Signed integer. */
|
614 |
|
|
#define FROM_INT_C_TYPE TItype
|
615 |
|
|
#define FROM_SINT_C_TYPE TItype
|
616 |
|
|
#define FROM_UINT_C_TYPE UTItype
|
617 |
|
|
#define FROM_MODE_NAME_S ti
|
618 |
|
|
#define FROM_INT_SIZE 16 /* in bytes. */
|
619 |
|
|
|
620 |
|
|
#elif defined (FROM_UQI) && HAVE_UQI == 1
|
621 |
|
|
#define FROM_TYPE 2 /* Unsigned integer. */
|
622 |
|
|
#define FROM_INT_C_TYPE QItype
|
623 |
|
|
#define FROM_SINT_C_TYPE QItype
|
624 |
|
|
#define FROM_UINT_C_TYPE UQItype
|
625 |
|
|
#define FROM_MODE_NAME_S qi
|
626 |
|
|
#define FROM_INT_SIZE 1 /* in bytes. */
|
627 |
|
|
|
628 |
|
|
#elif defined (FROM_UHI) && HAVE_UHI == 1
|
629 |
|
|
#define FROM_TYPE 2 /* Unsigned integer. */
|
630 |
|
|
#define FROM_INT_C_TYPE UHItype
|
631 |
|
|
#define FROM_SINT_C_TYPE HItype
|
632 |
|
|
#define FROM_UINT_C_TYPE UHItype
|
633 |
|
|
#define FROM_MODE_NAME_S hi
|
634 |
|
|
#define FROM_INT_SIZE 2 /* in bytes. */
|
635 |
|
|
|
636 |
|
|
#elif defined (FROM_USI) && HAVE_USI == 1
|
637 |
|
|
#define FROM_TYPE 2 /* Unsigned integer. */
|
638 |
|
|
#define FROM_INT_C_TYPE USItype
|
639 |
|
|
#define FROM_SINT_C_TYPE SItype
|
640 |
|
|
#define FROM_UINT_C_TYPE USItype
|
641 |
|
|
#define FROM_MODE_NAME_S si
|
642 |
|
|
#define FROM_INT_SIZE 4 /* in bytes. */
|
643 |
|
|
|
644 |
|
|
#elif defined (FROM_UDI) && HAVE_UDI == 1
|
645 |
|
|
#define FROM_TYPE 2 /* Unsigned integer. */
|
646 |
|
|
#define FROM_INT_C_TYPE UDItype
|
647 |
|
|
#define FROM_SINT_C_TYPE DItype
|
648 |
|
|
#define FROM_UINT_C_TYPE UDItype
|
649 |
|
|
#define FROM_MODE_NAME_S di
|
650 |
|
|
#define FROM_INT_SIZE 8 /* in bytes. */
|
651 |
|
|
|
652 |
|
|
#elif defined (FROM_UTI) && HAVE_UTI == 1
|
653 |
|
|
#define FROM_TYPE 2 /* Unsigned integer. */
|
654 |
|
|
#define FROM_INT_C_TYPE UTItype
|
655 |
|
|
#define FROM_SINT_C_TYPE TItype
|
656 |
|
|
#define FROM_UINT_C_TYPE UTItype
|
657 |
|
|
#define FROM_MODE_NAME_S ti
|
658 |
|
|
#define FROM_INT_SIZE 16 /* in bytes. */
|
659 |
|
|
|
660 |
|
|
#elif defined (FROM_SF) && HAVE_SF == 1
|
661 |
|
|
#define FROM_TYPE 3 /* Floating-point. */
|
662 |
|
|
#define FROM_FLOAT_C_TYPE SFtype
|
663 |
|
|
#define FROM_MODE_NAME_S sf
|
664 |
|
|
|
665 |
|
|
#elif defined (FROM_DF) && HAVE_DF == 1
|
666 |
|
|
#define FROM_TYPE 3 /* Floating-point. */
|
667 |
|
|
#define FROM_FLOAT_C_TYPE DFtype
|
668 |
|
|
#define FROM_MODE_NAME_S df
|
669 |
|
|
|
670 |
|
|
#elif defined (FROM_QQ) && HAVE_QQ == 1
|
671 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
672 |
|
|
#define FROM_MODE_NAME QQ
|
673 |
|
|
#define FROM_MODE_NAME_S qq
|
674 |
|
|
#define FROM_INT_C_TYPE QItype
|
675 |
|
|
#define FROM_SINT_C_TYPE QItype
|
676 |
|
|
#define FROM_UINT_C_TYPE UQItype
|
677 |
|
|
#define FROM_MODE_UNSIGNED 0
|
678 |
|
|
#define FROM_FIXED_SIZE 1 /* in bytes. */
|
679 |
|
|
|
680 |
|
|
#elif defined (FROM_HQ) && HAVE_HQ == 1
|
681 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
682 |
|
|
#define FROM_MODE_NAME HQ
|
683 |
|
|
#define FROM_MODE_NAME_S hq
|
684 |
|
|
#define FROM_INT_C_TYPE HItype
|
685 |
|
|
#define FROM_SINT_C_TYPE HItype
|
686 |
|
|
#define FROM_UINT_C_TYPE UHItype
|
687 |
|
|
#define FROM_MODE_UNSIGNED 0
|
688 |
|
|
#define FROM_FIXED_SIZE 2 /* in bytes. */
|
689 |
|
|
|
690 |
|
|
#elif defined (FROM_SQ) && HAVE_SQ == 1
|
691 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
692 |
|
|
#define FROM_MODE_NAME SQ
|
693 |
|
|
#define FROM_MODE_NAME_S sq
|
694 |
|
|
#define FROM_INT_C_TYPE SItype
|
695 |
|
|
#define FROM_SINT_C_TYPE SItype
|
696 |
|
|
#define FROM_UINT_C_TYPE USItype
|
697 |
|
|
#define FROM_MODE_UNSIGNED 0
|
698 |
|
|
#define FROM_FIXED_SIZE 4 /* in bytes. */
|
699 |
|
|
|
700 |
|
|
#elif defined (FROM_DQ) && HAVE_DQ == 1
|
701 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
702 |
|
|
#define FROM_MODE_NAME DQ
|
703 |
|
|
#define FROM_MODE_NAME_S dq
|
704 |
|
|
#define FROM_INT_C_TYPE DItype
|
705 |
|
|
#define FROM_SINT_C_TYPE DItype
|
706 |
|
|
#define FROM_UINT_C_TYPE UDItype
|
707 |
|
|
#define FROM_MODE_UNSIGNED 0
|
708 |
|
|
#define FROM_FIXED_SIZE 8 /* in bytes. */
|
709 |
|
|
|
710 |
|
|
#elif defined (FROM_TQ) && HAVE_TQ == 1
|
711 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
712 |
|
|
#define FROM_MODE_NAME TQ
|
713 |
|
|
#define FROM_MODE_NAME_S tq
|
714 |
|
|
#define FROM_INT_C_TYPE TItype
|
715 |
|
|
#define FROM_SINT_C_TYPE TItype
|
716 |
|
|
#define FROM_UINT_C_TYPE UTItype
|
717 |
|
|
#define FROM_MODE_UNSIGNED 0
|
718 |
|
|
#define FROM_FIXED_SIZE 16 /* in bytes. */
|
719 |
|
|
|
720 |
|
|
#elif defined (FROM_UQQ) && HAVE_UQQ == 1
|
721 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
722 |
|
|
#define FROM_MODE_NAME UQQ
|
723 |
|
|
#define FROM_MODE_NAME_S uqq
|
724 |
|
|
#define FROM_INT_C_TYPE UQItype
|
725 |
|
|
#define FROM_SINT_C_TYPE QItype
|
726 |
|
|
#define FROM_UINT_C_TYPE UQItype
|
727 |
|
|
#define FROM_MODE_UNSIGNED 1
|
728 |
|
|
#define FROM_FIXED_SIZE 1 /* in bytes. */
|
729 |
|
|
|
730 |
|
|
#elif defined (FROM_UHQ) && HAVE_UHQ == 1
|
731 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
732 |
|
|
#define FROM_MODE_NAME UHQ
|
733 |
|
|
#define FROM_MODE_NAME_S uhq
|
734 |
|
|
#define FROM_INT_C_TYPE UHItype
|
735 |
|
|
#define FROM_SINT_C_TYPE HItype
|
736 |
|
|
#define FROM_UINT_C_TYPE UHItype
|
737 |
|
|
#define FROM_MODE_UNSIGNED 1
|
738 |
|
|
#define FROM_FIXED_SIZE 2 /* in bytes. */
|
739 |
|
|
|
740 |
|
|
#elif defined (FROM_USQ) && HAVE_USQ == 1
|
741 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
742 |
|
|
#define FROM_MODE_NAME USQ
|
743 |
|
|
#define FROM_MODE_NAME_S usq
|
744 |
|
|
#define FROM_INT_C_TYPE USItype
|
745 |
|
|
#define FROM_SINT_C_TYPE SItype
|
746 |
|
|
#define FROM_UINT_C_TYPE USItype
|
747 |
|
|
#define FROM_MODE_UNSIGNED 1
|
748 |
|
|
#define FROM_FIXED_SIZE 4 /* in bytes. */
|
749 |
|
|
|
750 |
|
|
#elif defined (FROM_UDQ) && HAVE_UDQ == 1
|
751 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
752 |
|
|
#define FROM_MODE_NAME UDQ
|
753 |
|
|
#define FROM_MODE_NAME_S udq
|
754 |
|
|
#define FROM_INT_C_TYPE UDItype
|
755 |
|
|
#define FROM_SINT_C_TYPE DItype
|
756 |
|
|
#define FROM_UINT_C_TYPE UDItype
|
757 |
|
|
#define FROM_MODE_UNSIGNED 1
|
758 |
|
|
#define FROM_FIXED_SIZE 8 /* in bytes. */
|
759 |
|
|
|
760 |
|
|
#elif defined (FROM_UTQ) && HAVE_UTQ == 1
|
761 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
762 |
|
|
#define FROM_MODE_NAME UTQ
|
763 |
|
|
#define FROM_MODE_NAME_S utq
|
764 |
|
|
#define FROM_INT_C_TYPE UTItype
|
765 |
|
|
#define FROM_SINT_C_TYPE TItype
|
766 |
|
|
#define FROM_UINT_C_TYPE UTItype
|
767 |
|
|
#define FROM_MODE_UNSIGNED 1
|
768 |
|
|
#define FROM_FIXED_SIZE 16 /* in bytes. */
|
769 |
|
|
|
770 |
|
|
#elif defined (FROM_HA) && HAVE_HA == 1
|
771 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
772 |
|
|
#define FROM_MODE_NAME HA
|
773 |
|
|
#define FROM_MODE_NAME_S ha
|
774 |
|
|
#define FROM_INT_C_TYPE HItype
|
775 |
|
|
#define FROM_SINT_C_TYPE HItype
|
776 |
|
|
#define FROM_UINT_C_TYPE UHItype
|
777 |
|
|
#define FROM_MODE_UNSIGNED 0
|
778 |
|
|
#define FROM_FIXED_SIZE 2 /* in bytes. */
|
779 |
|
|
|
780 |
|
|
#elif defined (FROM_SA) && HAVE_SA == 1
|
781 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
782 |
|
|
#define FROM_MODE_NAME SA
|
783 |
|
|
#define FROM_MODE_NAME_S sa
|
784 |
|
|
#define FROM_INT_C_TYPE SItype
|
785 |
|
|
#define FROM_SINT_C_TYPE SItype
|
786 |
|
|
#define FROM_UINT_C_TYPE USItype
|
787 |
|
|
#define FROM_MODE_UNSIGNED 0
|
788 |
|
|
#define FROM_FIXED_SIZE 4 /* in bytes. */
|
789 |
|
|
|
790 |
|
|
#elif defined (FROM_DA) && HAVE_DA == 1
|
791 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
792 |
|
|
#define FROM_MODE_NAME DA
|
793 |
|
|
#define FROM_MODE_NAME_S da
|
794 |
|
|
#define FROM_INT_C_TYPE DItype
|
795 |
|
|
#define FROM_SINT_C_TYPE DItype
|
796 |
|
|
#define FROM_UINT_C_TYPE UDItype
|
797 |
|
|
#define FROM_MODE_UNSIGNED 0
|
798 |
|
|
#define FROM_FIXED_SIZE 8 /* in bytes. */
|
799 |
|
|
|
800 |
|
|
#elif defined (FROM_TA) && HAVE_TA == 1
|
801 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
802 |
|
|
#define FROM_MODE_NAME TA
|
803 |
|
|
#define FROM_MODE_NAME_S ta
|
804 |
|
|
#define FROM_INT_C_TYPE TItype
|
805 |
|
|
#define FROM_SINT_C_TYPE TItype
|
806 |
|
|
#define FROM_UINT_C_TYPE UTItype
|
807 |
|
|
#define FROM_MODE_UNSIGNED 0
|
808 |
|
|
#define FROM_FIXED_SIZE 16 /* in bytes. */
|
809 |
|
|
|
810 |
|
|
#elif defined (FROM_UHA) && HAVE_UHA == 1
|
811 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
812 |
|
|
#define FROM_MODE_NAME UHA
|
813 |
|
|
#define FROM_MODE_NAME_S uha
|
814 |
|
|
#define FROM_INT_C_TYPE UHItype
|
815 |
|
|
#define FROM_SINT_C_TYPE HItype
|
816 |
|
|
#define FROM_UINT_C_TYPE UHItype
|
817 |
|
|
#define FROM_MODE_UNSIGNED 1
|
818 |
|
|
#define FROM_FIXED_SIZE 2 /* in bytes. */
|
819 |
|
|
|
820 |
|
|
#elif defined (FROM_USA) && HAVE_USA == 1
|
821 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
822 |
|
|
#define FROM_MODE_NAME USA
|
823 |
|
|
#define FROM_MODE_NAME_S usa
|
824 |
|
|
#define FROM_INT_C_TYPE USItype
|
825 |
|
|
#define FROM_SINT_C_TYPE SItype
|
826 |
|
|
#define FROM_UINT_C_TYPE USItype
|
827 |
|
|
#define FROM_MODE_UNSIGNED 1
|
828 |
|
|
#define FROM_FIXED_SIZE 4 /* in bytes. */
|
829 |
|
|
|
830 |
|
|
#elif defined (FROM_UDA) && HAVE_UDA == 1
|
831 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
832 |
|
|
#define FROM_MODE_NAME UDA
|
833 |
|
|
#define FROM_MODE_NAME_S uda
|
834 |
|
|
#define FROM_INT_C_TYPE UDItype
|
835 |
|
|
#define FROM_SINT_C_TYPE DItype
|
836 |
|
|
#define FROM_UINT_C_TYPE UDItype
|
837 |
|
|
#define FROM_MODE_UNSIGNED 1
|
838 |
|
|
#define FROM_FIXED_SIZE 8 /* in bytes. */
|
839 |
|
|
|
840 |
|
|
#elif defined (FROM_UTA) && HAVE_UTA == 1
|
841 |
|
|
#define FROM_TYPE 4 /* Fixed-point. */
|
842 |
|
|
#define FROM_MODE_NAME UTA
|
843 |
|
|
#define FROM_MODE_NAME_S uta
|
844 |
|
|
#define FROM_INT_C_TYPE UTItype
|
845 |
|
|
#define FROM_SINT_C_TYPE TItype
|
846 |
|
|
#define FROM_UINT_C_TYPE UTItype
|
847 |
|
|
#define FROM_MODE_UNSIGNED 1
|
848 |
|
|
#define FROM_FIXED_SIZE 16 /* in bytes. */
|
849 |
|
|
|
850 |
|
|
#endif
|
851 |
|
|
|
852 |
|
|
#if defined (TO_QI) && HAVE_QI == 1 && !defined (FROM_QI)
|
853 |
|
|
#define TO_TYPE 1 /* Signed integer. */
|
854 |
|
|
#define TO_INT_C_TYPE QItype
|
855 |
|
|
#define TO_SINT_C_TYPE QItype
|
856 |
|
|
#define TO_UINT_C_TYPE UQItype
|
857 |
|
|
#define TO_MODE_NAME_S qi
|
858 |
|
|
|
859 |
|
|
#elif defined (TO_HI) && HAVE_HI == 1 && !defined (FROM_HI)
|
860 |
|
|
#define TO_TYPE 1 /* Signed integer. */
|
861 |
|
|
#define TO_INT_C_TYPE HItype
|
862 |
|
|
#define TO_SINT_C_TYPE HItype
|
863 |
|
|
#define TO_UINT_C_TYPE UHItype
|
864 |
|
|
#define TO_MODE_NAME_S hi
|
865 |
|
|
|
866 |
|
|
#elif defined (TO_SI) && HAVE_SI == 1 && !defined (FROM_SI)
|
867 |
|
|
#define TO_TYPE 1 /* Signed integer. */
|
868 |
|
|
#define TO_INT_C_TYPE SItype
|
869 |
|
|
#define TO_SINT_C_TYPE SItype
|
870 |
|
|
#define TO_UINT_C_TYPE USItype
|
871 |
|
|
#define TO_MODE_NAME_S si
|
872 |
|
|
|
873 |
|
|
#elif defined (TO_DI) && HAVE_DI == 1 && !defined (FROM_DI)
|
874 |
|
|
#define TO_TYPE 1 /* Signed integer. */
|
875 |
|
|
#define TO_INT_C_TYPE DItype
|
876 |
|
|
#define TO_SINT_C_TYPE DItype
|
877 |
|
|
#define TO_UINT_C_TYPE UDItype
|
878 |
|
|
#define TO_MODE_NAME_S di
|
879 |
|
|
|
880 |
|
|
#elif defined (TO_TI) && HAVE_TI == 1 && !defined (FROM_TI)
|
881 |
|
|
#define TO_TYPE 1 /* Signed integer. */
|
882 |
|
|
#define TO_INT_C_TYPE TItype
|
883 |
|
|
#define TO_SINT_C_TYPE TItype
|
884 |
|
|
#define TO_UINT_C_TYPE UTItype
|
885 |
|
|
#define TO_MODE_NAME_S ti
|
886 |
|
|
|
887 |
|
|
#elif defined (TO_UQI) && HAVE_UQI == 1 && !defined (FROM_UQI)
|
888 |
|
|
#define TO_TYPE 2 /* Unsigned integer. */
|
889 |
|
|
#define TO_INT_C_TYPE UQItype
|
890 |
|
|
#define TO_SINT_C_TYPE QItype
|
891 |
|
|
#define TO_UINT_C_TYPE UQItype
|
892 |
|
|
#define TO_MODE_NAME_S qi
|
893 |
|
|
|
894 |
|
|
#elif defined (TO_UHI) && HAVE_UHI == 1 && !defined (FROM_UHI)
|
895 |
|
|
#define TO_TYPE 2 /* Unsigned integer. */
|
896 |
|
|
#define TO_INT_C_TYPE UHItype
|
897 |
|
|
#define TO_SINT_C_TYPE HItype
|
898 |
|
|
#define TO_UINT_C_TYPE UHItype
|
899 |
|
|
#define TO_MODE_NAME_S hi
|
900 |
|
|
|
901 |
|
|
#elif defined (TO_USI) && HAVE_USI == 1 && !defined (FROM_USI)
|
902 |
|
|
#define TO_TYPE 2 /* Unsigned integer. */
|
903 |
|
|
#define TO_INT_C_TYPE USItype
|
904 |
|
|
#define TO_SINT_C_TYPE SItype
|
905 |
|
|
#define TO_UINT_C_TYPE USItype
|
906 |
|
|
#define TO_MODE_NAME_S si
|
907 |
|
|
|
908 |
|
|
#elif defined (TO_UDI) && HAVE_UDI == 1 && !defined (FROM_UDI)
|
909 |
|
|
#define TO_TYPE 2 /* Unsigned integer. */
|
910 |
|
|
#define TO_INT_C_TYPE UDItype
|
911 |
|
|
#define TO_SINT_C_TYPE DItype
|
912 |
|
|
#define TO_UINT_C_TYPE UDItype
|
913 |
|
|
#define TO_MODE_NAME_S di
|
914 |
|
|
|
915 |
|
|
#elif defined (TO_UTI) && HAVE_UTI == 1 && !defined (FROM_UTI)
|
916 |
|
|
#define TO_TYPE 2 /* Unsigned integer. */
|
917 |
|
|
#define TO_INT_C_TYPE UTItype
|
918 |
|
|
#define TO_SINT_C_TYPE TItype
|
919 |
|
|
#define TO_UINT_C_TYPE UTItype
|
920 |
|
|
#define TO_MODE_NAME_S ti
|
921 |
|
|
|
922 |
|
|
#elif defined (TO_SF) && HAVE_SF == 1 && !defined (FROM_SF)
|
923 |
|
|
#define TO_TYPE 3 /* Floating-point. */
|
924 |
|
|
#define TO_FLOAT_C_TYPE SFtype
|
925 |
|
|
#define TO_MODE_NAME_S sf
|
926 |
|
|
|
927 |
|
|
#elif defined (TO_DF) && HAVE_DF == 1 && !defined (FROM_DF)
|
928 |
|
|
#define TO_TYPE 3 /* Floating-point. */
|
929 |
|
|
#define TO_FLOAT_C_TYPE DFtype
|
930 |
|
|
#define TO_MODE_NAME_S df
|
931 |
|
|
|
932 |
|
|
#elif defined (TO_QQ) && HAVE_QQ == 1 && !defined (FROM_QQ)
|
933 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
934 |
|
|
#define TO_MODE_NAME QQ
|
935 |
|
|
#define TO_MODE_NAME_S qq
|
936 |
|
|
#define TO_INT_C_TYPE QItype
|
937 |
|
|
#define TO_SINT_C_TYPE QItype
|
938 |
|
|
#define TO_UINT_C_TYPE UQItype
|
939 |
|
|
#define TO_MODE_UNSIGNED 0
|
940 |
|
|
#define TO_FIXED_SIZE 1 /* in bytes. */
|
941 |
|
|
|
942 |
|
|
#elif defined (TO_HQ) && HAVE_HQ == 1 && !defined (FROM_HQ)
|
943 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
944 |
|
|
#define TO_MODE_NAME HQ
|
945 |
|
|
#define TO_MODE_NAME_S hq
|
946 |
|
|
#define TO_INT_C_TYPE HItype
|
947 |
|
|
#define TO_SINT_C_TYPE HItype
|
948 |
|
|
#define TO_UINT_C_TYPE UHItype
|
949 |
|
|
#define TO_MODE_UNSIGNED 0
|
950 |
|
|
#define TO_FIXED_SIZE 2 /* in bytes. */
|
951 |
|
|
|
952 |
|
|
#elif defined (TO_SQ) && HAVE_SQ == 1 && !defined (FROM_SQ)
|
953 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
954 |
|
|
#define TO_MODE_NAME SQ
|
955 |
|
|
#define TO_MODE_NAME_S sq
|
956 |
|
|
#define TO_INT_C_TYPE SItype
|
957 |
|
|
#define TO_SINT_C_TYPE SItype
|
958 |
|
|
#define TO_UINT_C_TYPE USItype
|
959 |
|
|
#define TO_MODE_UNSIGNED 0
|
960 |
|
|
#define TO_FIXED_SIZE 4 /* in bytes. */
|
961 |
|
|
|
962 |
|
|
#elif defined (TO_DQ) && HAVE_DQ == 1 && !defined (FROM_DQ)
|
963 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
964 |
|
|
#define TO_MODE_NAME DQ
|
965 |
|
|
#define TO_MODE_NAME_S dq
|
966 |
|
|
#define TO_INT_C_TYPE DItype
|
967 |
|
|
#define TO_SINT_C_TYPE DItype
|
968 |
|
|
#define TO_UINT_C_TYPE UDItype
|
969 |
|
|
#define TO_MODE_UNSIGNED 0
|
970 |
|
|
#define TO_FIXED_SIZE 8 /* in bytes. */
|
971 |
|
|
|
972 |
|
|
#elif defined (TO_TQ) && HAVE_TQ == 1 && !defined (FROM_TQ)
|
973 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
974 |
|
|
#define TO_MODE_NAME TQ
|
975 |
|
|
#define TO_MODE_NAME_S tq
|
976 |
|
|
#define TO_INT_C_TYPE TItype
|
977 |
|
|
#define TO_SINT_C_TYPE TItype
|
978 |
|
|
#define TO_UINT_C_TYPE UTItype
|
979 |
|
|
#define TO_MODE_UNSIGNED 0
|
980 |
|
|
#define TO_FIXED_SIZE 16 /* in bytes. */
|
981 |
|
|
|
982 |
|
|
#elif defined (TO_UQQ) && HAVE_UQQ == 1 && !defined (FROM_UQQ)
|
983 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
984 |
|
|
#define TO_MODE_NAME UQQ
|
985 |
|
|
#define TO_MODE_NAME_S uqq
|
986 |
|
|
#define TO_INT_C_TYPE UQItype
|
987 |
|
|
#define TO_SINT_C_TYPE QItype
|
988 |
|
|
#define TO_UINT_C_TYPE UQItype
|
989 |
|
|
#define TO_MODE_UNSIGNED 1
|
990 |
|
|
#define TO_FIXED_SIZE 1 /* in bytes. */
|
991 |
|
|
|
992 |
|
|
#elif defined (TO_UHQ) && HAVE_UHQ == 1 && !defined (FROM_UHQ)
|
993 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
994 |
|
|
#define TO_MODE_NAME UHQ
|
995 |
|
|
#define TO_MODE_NAME_S uhq
|
996 |
|
|
#define TO_INT_C_TYPE UHItype
|
997 |
|
|
#define TO_SINT_C_TYPE HItype
|
998 |
|
|
#define TO_UINT_C_TYPE UHItype
|
999 |
|
|
#define TO_MODE_UNSIGNED 1
|
1000 |
|
|
#define TO_FIXED_SIZE 2 /* in bytes. */
|
1001 |
|
|
|
1002 |
|
|
#elif defined (TO_USQ) && HAVE_USQ == 1 && !defined (FROM_USQ)
|
1003 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1004 |
|
|
#define TO_MODE_NAME USQ
|
1005 |
|
|
#define TO_MODE_NAME_S usq
|
1006 |
|
|
#define TO_INT_C_TYPE USItype
|
1007 |
|
|
#define TO_SINT_C_TYPE SItype
|
1008 |
|
|
#define TO_UINT_C_TYPE USItype
|
1009 |
|
|
#define TO_MODE_UNSIGNED 1
|
1010 |
|
|
#define TO_FIXED_SIZE 4 /* in bytes. */
|
1011 |
|
|
|
1012 |
|
|
#elif defined (TO_UDQ) && HAVE_UDQ == 1 && !defined (FROM_UDQ)
|
1013 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1014 |
|
|
#define TO_MODE_NAME UDQ
|
1015 |
|
|
#define TO_MODE_NAME_S udq
|
1016 |
|
|
#define TO_INT_C_TYPE UDItype
|
1017 |
|
|
#define TO_SINT_C_TYPE DItype
|
1018 |
|
|
#define TO_UINT_C_TYPE UDItype
|
1019 |
|
|
#define TO_MODE_UNSIGNED 1
|
1020 |
|
|
#define TO_FIXED_SIZE 8 /* in bytes. */
|
1021 |
|
|
|
1022 |
|
|
#elif defined (TO_UTQ) && HAVE_UTQ == 1 && !defined (FROM_UTQ)
|
1023 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1024 |
|
|
#define TO_MODE_NAME UTQ
|
1025 |
|
|
#define TO_MODE_NAME_S utq
|
1026 |
|
|
#define TO_INT_C_TYPE UTItype
|
1027 |
|
|
#define TO_SINT_C_TYPE TItype
|
1028 |
|
|
#define TO_UINT_C_TYPE UTItype
|
1029 |
|
|
#define TO_MODE_UNSIGNED 1
|
1030 |
|
|
#define TO_FIXED_SIZE 16 /* in bytes. */
|
1031 |
|
|
|
1032 |
|
|
#elif defined (TO_HA) && HAVE_HA == 1 && !defined (FROM_HA)
|
1033 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1034 |
|
|
#define TO_MODE_NAME HA
|
1035 |
|
|
#define TO_MODE_NAME_S ha
|
1036 |
|
|
#define TO_INT_C_TYPE HItype
|
1037 |
|
|
#define TO_SINT_C_TYPE HItype
|
1038 |
|
|
#define TO_UINT_C_TYPE UHItype
|
1039 |
|
|
#define TO_MODE_UNSIGNED 0
|
1040 |
|
|
#define TO_FIXED_SIZE 2 /* in bytes. */
|
1041 |
|
|
|
1042 |
|
|
#elif defined (TO_SA) && HAVE_SA == 1 && !defined (FROM_SA)
|
1043 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1044 |
|
|
#define TO_MODE_NAME SA
|
1045 |
|
|
#define TO_MODE_NAME_S sa
|
1046 |
|
|
#define TO_INT_C_TYPE SItype
|
1047 |
|
|
#define TO_SINT_C_TYPE SItype
|
1048 |
|
|
#define TO_UINT_C_TYPE USItype
|
1049 |
|
|
#define TO_MODE_UNSIGNED 0
|
1050 |
|
|
#define TO_FIXED_SIZE 4 /* in bytes. */
|
1051 |
|
|
|
1052 |
|
|
#elif defined (TO_DA) && HAVE_DA == 1 && !defined (FROM_DA)
|
1053 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1054 |
|
|
#define TO_MODE_NAME DA
|
1055 |
|
|
#define TO_MODE_NAME_S da
|
1056 |
|
|
#define TO_INT_C_TYPE DItype
|
1057 |
|
|
#define TO_SINT_C_TYPE DItype
|
1058 |
|
|
#define TO_UINT_C_TYPE UDItype
|
1059 |
|
|
#define TO_MODE_UNSIGNED 0
|
1060 |
|
|
#define TO_FIXED_SIZE 8 /* in bytes. */
|
1061 |
|
|
|
1062 |
|
|
#elif defined (TO_TA) && HAVE_TA == 1 && !defined (FROM_TA)
|
1063 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1064 |
|
|
#define TO_MODE_NAME TA
|
1065 |
|
|
#define TO_MODE_NAME_S ta
|
1066 |
|
|
#define TO_INT_C_TYPE TItype
|
1067 |
|
|
#define TO_SINT_C_TYPE TItype
|
1068 |
|
|
#define TO_UINT_C_TYPE UTItype
|
1069 |
|
|
#define TO_MODE_UNSIGNED 0
|
1070 |
|
|
#define TO_FIXED_SIZE 16 /* in bytes. */
|
1071 |
|
|
|
1072 |
|
|
#elif defined (TO_UHA) && HAVE_UHA == 1 && !defined (FROM_UHA)
|
1073 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1074 |
|
|
#define TO_MODE_NAME UHA
|
1075 |
|
|
#define TO_MODE_NAME_S uha
|
1076 |
|
|
#define TO_INT_C_TYPE UHItype
|
1077 |
|
|
#define TO_SINT_C_TYPE HItype
|
1078 |
|
|
#define TO_UINT_C_TYPE UHItype
|
1079 |
|
|
#define TO_MODE_UNSIGNED 1
|
1080 |
|
|
#define TO_FIXED_SIZE 2 /* in bytes. */
|
1081 |
|
|
|
1082 |
|
|
#elif defined (TO_USA) && HAVE_USA == 1 && !defined (FROM_USA)
|
1083 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1084 |
|
|
#define TO_MODE_NAME USA
|
1085 |
|
|
#define TO_MODE_NAME_S usa
|
1086 |
|
|
#define TO_INT_C_TYPE USItype
|
1087 |
|
|
#define TO_SINT_C_TYPE SItype
|
1088 |
|
|
#define TO_UINT_C_TYPE USItype
|
1089 |
|
|
#define TO_MODE_UNSIGNED 1
|
1090 |
|
|
#define TO_FIXED_SIZE 4 /* in bytes. */
|
1091 |
|
|
|
1092 |
|
|
#elif defined (TO_UDA) && HAVE_UDA == 1 && !defined (FROM_UDA)
|
1093 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1094 |
|
|
#define TO_MODE_NAME UDA
|
1095 |
|
|
#define TO_MODE_NAME_S uda
|
1096 |
|
|
#define TO_INT_C_TYPE UDItype
|
1097 |
|
|
#define TO_SINT_C_TYPE DItype
|
1098 |
|
|
#define TO_UINT_C_TYPE UDItype
|
1099 |
|
|
#define TO_MODE_UNSIGNED 1
|
1100 |
|
|
#define TO_FIXED_SIZE 8 /* in bytes. */
|
1101 |
|
|
|
1102 |
|
|
#elif defined (TO_UTA) && HAVE_UTA == 1 && !defined (FROM_UTA)
|
1103 |
|
|
#define TO_TYPE 4 /* Fixed-point. */
|
1104 |
|
|
#define TO_MODE_NAME UTA
|
1105 |
|
|
#define TO_MODE_NAME_S uta
|
1106 |
|
|
#define TO_INT_C_TYPE UTItype
|
1107 |
|
|
#define TO_SINT_C_TYPE TItype
|
1108 |
|
|
#define TO_UINT_C_TYPE UTItype
|
1109 |
|
|
#define TO_MODE_UNSIGNED 1
|
1110 |
|
|
#define TO_FIXED_SIZE 16 /* in bytes. */
|
1111 |
|
|
|
1112 |
|
|
#endif
|
1113 |
|
|
|
1114 |
|
|
#if defined (FROM_MODE_NAME_S) && defined (TO_MODE_NAME_S)
|
1115 |
|
|
|
1116 |
|
|
#if FROM_TYPE == 1 /* Signed integer. */
|
1117 |
|
|
#define FROM_INT_WIDTH (FROM_INT_SIZE * BITS_PER_UNIT)
|
1118 |
|
|
#endif
|
1119 |
|
|
|
1120 |
|
|
#if FROM_TYPE == 2 /* Unsigned integer. */
|
1121 |
|
|
#define FROM_INT_WIDTH (FROM_INT_SIZE * BITS_PER_UNIT)
|
1122 |
|
|
#endif
|
1123 |
|
|
|
1124 |
|
|
#if FROM_TYPE == 4 /* Fixed-point. */
|
1125 |
|
|
#define FROM_FIXED_C_TYPE FIXED_C_TYPE2(FROM_MODE_NAME)
|
1126 |
|
|
#define FROM_FBITS FBITS2(FROM_MODE_NAME)
|
1127 |
|
|
#define FROM_FIXED_WIDTH (FROM_FIXED_SIZE * BITS_PER_UNIT)
|
1128 |
|
|
#define FROM_FBITS FBITS2(FROM_MODE_NAME)
|
1129 |
|
|
#define FROM_IBITS IBITS2(FROM_MODE_NAME)
|
1130 |
|
|
#define FROM_I_F_BITS (FROM_FBITS + FROM_IBITS)
|
1131 |
|
|
|
1132 |
|
|
#if FROM_MODE_UNSIGNED == 0 /* Signed types. */
|
1133 |
|
|
#define FROM_PADDING_BITS (FROM_FIXED_WIDTH - 1 - FROM_I_F_BITS)
|
1134 |
|
|
#define FROM_NONPADDING_BITS (1 + FROM_I_F_BITS)
|
1135 |
|
|
#else /* Unsigned types. */
|
1136 |
|
|
#define FROM_PADDING_BITS (FROM_FIXED_WIDTH - FROM_I_F_BITS)
|
1137 |
|
|
#define FROM_NONPADDING_BITS (FROM_I_F_BITS)
|
1138 |
|
|
#endif
|
1139 |
|
|
#define FROM_HAVE_PADDING_BITS (FROM_PADDING_BITS > 0)
|
1140 |
|
|
#endif /* FROM_TYPE == 4 */
|
1141 |
|
|
|
1142 |
|
|
#if TO_TYPE == 4 /* Fixed-point. */
|
1143 |
|
|
#define TO_FIXED_C_TYPE FIXED_C_TYPE2(TO_MODE_NAME)
|
1144 |
|
|
#define TO_FBITS FBITS2(TO_MODE_NAME)
|
1145 |
|
|
#define TO_FIXED_WIDTH (TO_FIXED_SIZE * BITS_PER_UNIT)
|
1146 |
|
|
#define TO_FBITS FBITS2(TO_MODE_NAME)
|
1147 |
|
|
#define TO_IBITS IBITS2(TO_MODE_NAME)
|
1148 |
|
|
#define TO_I_F_BITS (TO_FBITS + TO_IBITS)
|
1149 |
|
|
|
1150 |
|
|
#if TO_MODE_UNSIGNED == 0 /* Signed types. */
|
1151 |
|
|
#define TO_PADDING_BITS (TO_FIXED_WIDTH - 1 - TO_I_F_BITS)
|
1152 |
|
|
#define TO_NONPADDING_BITS (1 + TO_I_F_BITS)
|
1153 |
|
|
#else /* Unsigned types. */
|
1154 |
|
|
#define TO_PADDING_BITS (TO_FIXED_WIDTH - TO_I_F_BITS)
|
1155 |
|
|
#define TO_NONPADDING_BITS (TO_I_F_BITS)
|
1156 |
|
|
#endif
|
1157 |
|
|
#define TO_HAVE_PADDING_BITS (TO_PADDING_BITS > 0)
|
1158 |
|
|
#endif /* TO_TYPE == 4 */
|
1159 |
|
|
|
1160 |
|
|
#define FIXED_CONVERT_OP(OP,FROM,TO) OP ## FROM ## TO
|
1161 |
|
|
#define FIXED_CONVERT_OP2(OP,FROM,TO) OP ## FROM ## TO ## 2
|
1162 |
|
|
#define FRACT_TEMP(N1,N2) FIXED_CONVERT_OP(__fract,N1,N2)
|
1163 |
|
|
#define FRACT2_TEMP(N1,N2) FIXED_CONVERT_OP2(__fract,N1,N2)
|
1164 |
|
|
#define SATFRACT_TEMP(N1,N2) FIXED_CONVERT_OP(__satfract,N1,N2)
|
1165 |
|
|
#define SATFRACT2_TEMP(N1,N2) FIXED_CONVERT_OP2(__satfract,N1,N2)
|
1166 |
|
|
#define FRACTUNS_TEMP(N1,N2) FIXED_CONVERT_OP(__fractuns,N1,N2)
|
1167 |
|
|
#define SATFRACTUNS_TEMP(N1,N2) FIXED_CONVERT_OP(__satfractuns,N1,N2)
|
1168 |
|
|
|
1169 |
|
|
/* Define conversions from fixed-point to fixed-point. */
|
1170 |
|
|
#if FROM_TYPE == 4 && TO_TYPE == 4
|
1171 |
|
|
|
1172 |
|
|
#if FROM_FIXED_SIZE > TO_FIXED_SIZE
|
1173 |
|
|
#define BIG_SINT_C_TYPE FROM_SINT_C_TYPE
|
1174 |
|
|
#define BIG_UINT_C_TYPE FROM_UINT_C_TYPE
|
1175 |
|
|
#define BIG_WIDTH FROM_FIXED_WIDTH
|
1176 |
|
|
#else
|
1177 |
|
|
#define BIG_SINT_C_TYPE TO_SINT_C_TYPE
|
1178 |
|
|
#define BIG_UINT_C_TYPE TO_UINT_C_TYPE
|
1179 |
|
|
#define BIG_WIDTH TO_FIXED_WIDTH
|
1180 |
|
|
#endif
|
1181 |
|
|
|
1182 |
|
|
/* Check if FROM* and TO* are in the same machine class. */
|
1183 |
|
|
#if ((FROM_MODE_UNSIGNED == TO_MODE_UNSIGNED) \
|
1184 |
|
|
&& ((FROM_IBITS == 0) == (TO_IBITS == 0)))
|
1185 |
|
|
/* Same modes: append '2' to conversion function names */
|
1186 |
|
|
#define FRACT FRACT2_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1187 |
|
|
#define SATFRACT SATFRACT2_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1188 |
|
|
#else
|
1189 |
|
|
/* Different modes: don't append '2' to conversion function names */
|
1190 |
|
|
#define FRACT FRACT_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1191 |
|
|
#define SATFRACT SATFRACT_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1192 |
|
|
#endif
|
1193 |
|
|
|
1194 |
|
|
extern TO_FIXED_C_TYPE FRACT (FROM_FIXED_C_TYPE);
|
1195 |
|
|
extern TO_FIXED_C_TYPE SATFRACT (FROM_FIXED_C_TYPE);
|
1196 |
|
|
#endif /* FROM_TYPE == 4 && TO_TYPE == 4 */
|
1197 |
|
|
|
1198 |
|
|
/* Define conversions from fixed-point to signed integer. */
|
1199 |
|
|
#if FROM_TYPE == 4 && TO_TYPE == 1
|
1200 |
|
|
#define FRACT FRACT_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1201 |
|
|
extern TO_INT_C_TYPE FRACT (FROM_FIXED_C_TYPE);
|
1202 |
|
|
#endif /* FROM_TYPE == 4 && TO_TYPE == 1 */
|
1203 |
|
|
|
1204 |
|
|
/* Define conversions from fixed-point to unsigned integer. */
|
1205 |
|
|
#if FROM_TYPE == 4 && TO_TYPE == 2
|
1206 |
|
|
#define FRACTUNS FRACTUNS_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1207 |
|
|
extern TO_INT_C_TYPE FRACTUNS (FROM_FIXED_C_TYPE);
|
1208 |
|
|
#endif /* FROM_TYPE == 4 && TO_TYPE == 2 */
|
1209 |
|
|
|
1210 |
|
|
/* Define conversions from fixed-point to floating-point. */
|
1211 |
|
|
#if FROM_TYPE == 4 && TO_TYPE == 3
|
1212 |
|
|
#define BASE1(NUM) 0x1.0p ## NUM
|
1213 |
|
|
#define BASE2(NUM) BASE1(NUM)
|
1214 |
|
|
#define BASE BASE2(FROM_FBITS)
|
1215 |
|
|
#define FRACT FRACT_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1216 |
|
|
extern TO_FLOAT_C_TYPE FRACT (FROM_FIXED_C_TYPE);
|
1217 |
|
|
#endif /* FROM_TYPE == 4 && TO_TYPE == 3 */
|
1218 |
|
|
|
1219 |
|
|
/* Define conversions from signed integer to fixed-point. */
|
1220 |
|
|
#if FROM_TYPE == 1 && TO_TYPE == 4
|
1221 |
|
|
|
1222 |
|
|
#if FROM_INT_SIZE > TO_FIXED_SIZE
|
1223 |
|
|
#define BIG_SINT_C_TYPE FROM_SINT_C_TYPE
|
1224 |
|
|
#define BIG_UINT_C_TYPE FROM_UINT_C_TYPE
|
1225 |
|
|
#define BIG_WIDTH FROM_INT_WIDTH
|
1226 |
|
|
#else
|
1227 |
|
|
#define BIG_SINT_C_TYPE TO_SINT_C_TYPE
|
1228 |
|
|
#define BIG_UINT_C_TYPE TO_UINT_C_TYPE
|
1229 |
|
|
#define BIG_WIDTH TO_FIXED_WIDTH
|
1230 |
|
|
#endif
|
1231 |
|
|
|
1232 |
|
|
#define FRACT FRACT_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1233 |
|
|
#define SATFRACT SATFRACT_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1234 |
|
|
extern TO_FIXED_C_TYPE FRACT (FROM_INT_C_TYPE);
|
1235 |
|
|
extern TO_FIXED_C_TYPE SATFRACT (FROM_INT_C_TYPE);
|
1236 |
|
|
#endif /* FROM_TYPE == 1 && TO_TYPE == 4 */
|
1237 |
|
|
|
1238 |
|
|
/* Define conversions from unsigned integer to fixed-point. */
|
1239 |
|
|
#if FROM_TYPE == 2 && TO_TYPE == 4
|
1240 |
|
|
|
1241 |
|
|
#if FROM_INT_SIZE > TO_FIXED_SIZE
|
1242 |
|
|
#define BIG_SINT_C_TYPE FROM_SINT_C_TYPE
|
1243 |
|
|
#define BIG_UINT_C_TYPE FROM_UINT_C_TYPE
|
1244 |
|
|
#define BIG_WIDTH FROM_INT_WIDTH
|
1245 |
|
|
#else
|
1246 |
|
|
#define BIG_SINT_C_TYPE TO_SINT_C_TYPE
|
1247 |
|
|
#define BIG_UINT_C_TYPE TO_UINT_C_TYPE
|
1248 |
|
|
#define BIG_WIDTH TO_FIXED_WIDTH
|
1249 |
|
|
#endif
|
1250 |
|
|
|
1251 |
|
|
#define FRACTUNS FRACTUNS_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1252 |
|
|
#define SATFRACTUNS SATFRACTUNS_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1253 |
|
|
extern TO_FIXED_C_TYPE FRACTUNS (FROM_INT_C_TYPE);
|
1254 |
|
|
extern TO_FIXED_C_TYPE SATFRACTUNS (FROM_INT_C_TYPE);
|
1255 |
|
|
#endif /* FROM_TYPE == 2 && TO_TYPE == 4 */
|
1256 |
|
|
|
1257 |
|
|
/* Define conversions from floating-point to fixed-point. */
|
1258 |
|
|
#if FROM_TYPE == 3 && TO_TYPE == 4
|
1259 |
|
|
|
1260 |
|
|
#define BASE1(NUM) (0x1.0p ## NUM)
|
1261 |
|
|
#define BASE2(NUM) BASE1(NUM)
|
1262 |
|
|
#define BASE BASE2(TO_FBITS)
|
1263 |
|
|
|
1264 |
|
|
#define FIXED_MAX1(NUM1,NUM2) (0x1.0p ## NUM1 - 0x1.0p- ## NUM2)
|
1265 |
|
|
#define FIXED_MAX2(NUM1,NUM2) FIXED_MAX1(NUM1,NUM2)
|
1266 |
|
|
#define FIXED_MAX FIXED_MAX2(TO_IBITS,TO_FBITS)
|
1267 |
|
|
|
1268 |
|
|
#define FIXED_MIN1(NUM) (-0x1.0p ## NUM)
|
1269 |
|
|
#define FIXED_MIN2(NUM) FIXED_MIN1(NUM)
|
1270 |
|
|
#if TO_MODE_UNSIGNED == 0
|
1271 |
|
|
#define FIXED_MIN FIXED_MIN2(TO_IBITS)
|
1272 |
|
|
#else
|
1273 |
|
|
#define FIXED_MIN 0.0
|
1274 |
|
|
#endif
|
1275 |
|
|
|
1276 |
|
|
#define FRACT FRACT_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1277 |
|
|
#define SATFRACT SATFRACT_TEMP(FROM_MODE_NAME_S,TO_MODE_NAME_S)
|
1278 |
|
|
extern TO_FIXED_C_TYPE FRACT (FROM_FLOAT_C_TYPE);
|
1279 |
|
|
extern TO_FIXED_C_TYPE SATFRACT (FROM_FLOAT_C_TYPE);
|
1280 |
|
|
#endif /* FROM_TYPE == 3 && TO_TYPE == 4 */
|
1281 |
|
|
|
1282 |
|
|
#endif /* defined (FROM_MODE_NAME_S) && defined (TO_MODE_NAME_S) */
|
1283 |
|
|
|
1284 |
|
|
#endif /* _FIXED_BIT_H */
|