OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [fixed-point/] [convert.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-std=gnu99 -O0" } */
3
 
4
/* C99 6.3 Conversions.
5
 
6
   Check conversions involving fixed-point.  */
7
 
8
extern void abort (void);
9
 
10
/* Fixed-point to fixed-point.  */
11
#define CONV(TYPE1,POSTFIX1,TYPE2,POSTFIX2) \
12
  { \
13
    TYPE1 a = 0.5 ## POSTFIX1; \
14
    TYPE2 b = a; \
15
    if (b != 0.5 ## POSTFIX2) \
16
      abort(); \
17
  }
18
 
19
/* TYPE1 with VALUE1 to TYPE2 with VALUE2.  */
20
#define CONV2(TYPE1,VALUE1,TYPE2,VALUE2) \
21
  { \
22
    TYPE1 a = VALUE1; \
23
    TYPE2 b = a; \
24
    if (b != VALUE2) \
25
      abort(); \
26
  }
27
 
28
/* Fixed-point to integer, and integer to fixed-point.  */
29
#define CONV_INT(TYPE1,POSTFIX1,TYPE2) \
30
  { \
31
    TYPE1 a = 0.5 ## POSTFIX1; \
32
    TYPE2 b = a; \
33
    TYPE2 c = 0; \
34
    TYPE1 d = c; \
35
    if (b != 0) \
36
      abort(); \
37
    if (d != 0.0 ## POSTFIX1) \
38
      abort(); \
39
  }
40
 
41
/* Signed fixed-point to integer.  */
42
#define CONV_INT2(TYPE1,POSTFIX1,TYPE2) \
43
  { \
44
    TYPE1 a = -0.5 ## POSTFIX1; \
45
    TYPE2 b = a; \
46
    if (b != 0) \
47
      abort(); \
48
    a = -0.0 ## POSTFIX1; \
49
    b = a; \
50
    if (b != 0) \
51
      abort(); \
52
    a = +0.0 ## POSTFIX1; \
53
    b = a; \
54
    if (b != 0) \
55
      abort(); \
56
    a = +0.1 ## POSTFIX1; \
57
    b = a; \
58
    if (b != 0) \
59
      abort(); \
60
    a = -0.1 ## POSTFIX1; \
61
    b = a; \
62
    if (b != 0) \
63
      abort(); \
64
  }
65
 
66
/* Signed fixed-point to signed integer.  */
67
#define CONV_INT3(TYPE1,POSTFIX1,TYPE2) \
68
  { \
69
    TYPE1 a = -0.5 ## POSTFIX1 - 0.5 ## POSTFIX1; \
70
    TYPE2 b = a; \
71
    if (b != -1) \
72
      abort(); \
73
  }
74
 
75
/* Fixed-point to floating-point, and floating-point to fixed-point.  */
76
#define CONV_FLOAT(TYPE1,POSTFIX1,TYPE2) \
77
  { \
78
    TYPE1 a = 0.5 ## POSTFIX1; \
79
    TYPE2 b = a; \
80
    TYPE2 c = 0.25; \
81
    TYPE1 d = c; \
82
    if (b != 0.5) \
83
      abort(); \
84
    if (d != 0.25 ## POSTFIX1) \
85
      abort(); \
86
  }
87
 
88
/* Accum to integer, and integer to accum.  */
89
#define CONV_ACCUM_INT(TYPE1,POSTFIX1,TYPE2) \
90
  { \
91
    TYPE1 a = 99.12345 ## POSTFIX1; \
92
    TYPE2 b = a; \
93
    TYPE2 c = 123; \
94
    TYPE1 d = c; \
95
    if (b != 99) \
96
      abort(); \
97
    if (d != 123.0 ## POSTFIX1) \
98
      abort(); \
99
  }
100
 
101
#define ALL_CONV(TYPE,POSTFIX) \
102
  CONV(TYPE, POSTFIX, short _Fract, hr) \
103
  CONV(TYPE, POSTFIX, _Fract, r) \
104
  CONV(TYPE, POSTFIX, long _Fract, lr) \
105
  CONV(TYPE, POSTFIX, long long _Fract, llr) \
106
  CONV(TYPE, POSTFIX, unsigned short _Fract, uhr) \
107
  CONV(TYPE, POSTFIX, unsigned _Fract, ur) \
108
  CONV(TYPE, POSTFIX, unsigned long _Fract, ulr) \
109
  CONV(TYPE, POSTFIX, unsigned long long _Fract, ullr) \
110
  CONV(TYPE, POSTFIX, short _Accum, hk) \
111
  CONV(TYPE, POSTFIX, _Accum, k) \
112
  CONV(TYPE, POSTFIX, long _Accum, lk) \
113
  CONV(TYPE, POSTFIX, long long _Accum, llk) \
114
  CONV(TYPE, POSTFIX, unsigned short _Accum, uhk) \
115
  CONV(TYPE, POSTFIX, unsigned _Accum, uk) \
116
  CONV(TYPE, POSTFIX, unsigned long _Accum, ulk) \
117
  CONV(TYPE, POSTFIX, unsigned long long _Accum, ullk) \
118
  CONV(_Sat TYPE, POSTFIX, short _Fract, hr) \
119
  CONV(_Sat TYPE, POSTFIX, _Fract, r) \
120
  CONV(_Sat TYPE, POSTFIX, long _Fract, lr) \
121
  CONV(_Sat TYPE, POSTFIX, long long _Fract, llr) \
122
  CONV(_Sat TYPE, POSTFIX, unsigned short _Fract, uhr) \
123
  CONV(_Sat TYPE, POSTFIX, unsigned _Fract, ur) \
124
  CONV(_Sat TYPE, POSTFIX, unsigned long _Fract, ulr) \
125
  CONV(_Sat TYPE, POSTFIX, unsigned long long _Fract, ullr) \
126
  CONV(_Sat TYPE, POSTFIX, short _Accum, hk) \
127
  CONV(_Sat TYPE, POSTFIX, _Accum, k) \
128
  CONV(_Sat TYPE, POSTFIX, long _Accum, lk) \
129
  CONV(_Sat TYPE, POSTFIX, long long _Accum, llk) \
130
  CONV(_Sat TYPE, POSTFIX, unsigned short _Accum, uhk) \
131
  CONV(_Sat TYPE, POSTFIX, unsigned _Accum, uk) \
132
  CONV(_Sat TYPE, POSTFIX, unsigned long _Accum, ulk) \
133
  CONV(_Sat TYPE, POSTFIX, unsigned long long _Accum, ullk) \
134
  CONV(TYPE, POSTFIX, _Sat short _Fract, hr) \
135
  CONV(TYPE, POSTFIX, _Sat _Fract, r) \
136
  CONV(TYPE, POSTFIX, _Sat long _Fract, lr) \
137
  CONV(TYPE, POSTFIX, _Sat long long _Fract, llr) \
138
  CONV(TYPE, POSTFIX, _Sat unsigned short _Fract, uhr) \
139
  CONV(TYPE, POSTFIX, _Sat unsigned _Fract, ur) \
140
  CONV(TYPE, POSTFIX, _Sat unsigned long _Fract, ulr) \
141
  CONV(TYPE, POSTFIX, _Sat unsigned long long _Fract, ullr) \
142
  CONV(TYPE, POSTFIX, _Sat short _Accum, hk) \
143
  CONV(TYPE, POSTFIX, _Sat _Accum, k) \
144
  CONV(TYPE, POSTFIX, _Sat long _Accum, lk) \
145
  CONV(TYPE, POSTFIX, _Sat long long _Accum, llk) \
146
  CONV(TYPE, POSTFIX, _Sat unsigned short _Accum, uhk) \
147
  CONV(TYPE, POSTFIX, _Sat unsigned _Accum, uk) \
148
  CONV(TYPE, POSTFIX, _Sat unsigned long _Accum, ulk) \
149
  CONV(TYPE, POSTFIX, _Sat unsigned long long _Accum, ullk) \
150
  CONV_INT(TYPE, POSTFIX, signed char) \
151
  CONV_INT(TYPE, POSTFIX, short) \
152
  CONV_INT(TYPE, POSTFIX, int) \
153
  CONV_INT(TYPE, POSTFIX, long) \
154
  CONV_INT(TYPE, POSTFIX, long long) \
155
  CONV_INT(TYPE, POSTFIX, unsigned char) \
156
  CONV_INT(TYPE, POSTFIX, unsigned short) \
157
  CONV_INT(TYPE, POSTFIX, unsigned int) \
158
  CONV_INT(TYPE, POSTFIX, unsigned long) \
159
  CONV_INT(TYPE, POSTFIX, unsigned long long) \
160
  CONV_INT(_Sat TYPE, POSTFIX, signed char) \
161
  CONV_INT(_Sat TYPE, POSTFIX, short) \
162
  CONV_INT(_Sat TYPE, POSTFIX, int) \
163
  CONV_INT(_Sat TYPE, POSTFIX, long) \
164
  CONV_INT(_Sat TYPE, POSTFIX, long long) \
165
  CONV_INT(_Sat TYPE, POSTFIX, unsigned char) \
166
  CONV_INT(_Sat TYPE, POSTFIX, unsigned short) \
167
  CONV_INT(_Sat TYPE, POSTFIX, unsigned int) \
168
  CONV_INT(_Sat TYPE, POSTFIX, unsigned long) \
169
  CONV_INT(_Sat TYPE, POSTFIX, unsigned long long) \
170
  CONV_FLOAT(TYPE, POSTFIX, float) \
171
  CONV_FLOAT(TYPE, POSTFIX, double) \
172
  CONV_FLOAT(_Sat TYPE, POSTFIX, float) \
173
  CONV_FLOAT(_Sat TYPE, POSTFIX, double)
174
 
175
#define ALL_ACCUM_CONV(TYPE,POSTFIX) \
176
  CONV_ACCUM_INT(TYPE, POSTFIX, signed char) \
177
  CONV_ACCUM_INT(TYPE, POSTFIX, short) \
178
  CONV_ACCUM_INT(TYPE, POSTFIX, int) \
179
  CONV_ACCUM_INT(TYPE, POSTFIX, long) \
180
  CONV_ACCUM_INT(TYPE, POSTFIX, long long) \
181
  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned char) \
182
  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned short) \
183
  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned int) \
184
  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned long) \
185
  CONV_ACCUM_INT(TYPE, POSTFIX, unsigned long long) \
186
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, signed char) \
187
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, short) \
188
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, int) \
189
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, long) \
190
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, long long) \
191
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned char) \
192
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned short) \
193
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned int) \
194
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned long) \
195
  CONV_ACCUM_INT(_Sat TYPE, POSTFIX, unsigned long long)
196
 
197
#define NEG_CONV(TYPE,POSTFIX) \
198
  CONV_INT2(TYPE, POSTFIX, signed char) \
199
  CONV_INT2(TYPE, POSTFIX, short) \
200
  CONV_INT2(TYPE, POSTFIX, int) \
201
  CONV_INT2(TYPE, POSTFIX, long) \
202
  CONV_INT2(TYPE, POSTFIX, long long) \
203
  CONV_INT2(TYPE, POSTFIX, unsigned char) \
204
  CONV_INT2(TYPE, POSTFIX, unsigned short) \
205
  CONV_INT2(TYPE, POSTFIX, unsigned int) \
206
  CONV_INT2(TYPE, POSTFIX, unsigned long) \
207
  CONV_INT2(TYPE, POSTFIX, unsigned long long) \
208
  CONV_INT3(TYPE, POSTFIX, signed char) \
209
  CONV_INT3(TYPE, POSTFIX, short) \
210
  CONV_INT3(TYPE, POSTFIX, int) \
211
  CONV_INT3(TYPE, POSTFIX, long) \
212
  CONV_INT3(TYPE, POSTFIX, long long)
213
 
214
/* Signed accum to _Sat unsigned/signed fract.  */
215
#define SAT_CONV1(TYPE, POSTFIX) \
216
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat short _Fract, 1.0hr) \
217
  CONV2(TYPE, -3.2 ## POSTFIX, _Sat short _Fract, -0.5hr - 0.5hr) \
218
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat _Fract, 1.0r) \
219
  CONV2(TYPE, -3.2 ## POSTFIX, _Sat _Fract, -0.5r - 0.5r) \
220
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat long _Fract, 1.0lr) \
221
  CONV2(TYPE, -3.2 ## POSTFIX, _Sat long _Fract, -0.5lr - 0.5lr) \
222
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat long long _Fract, 1.0llr) \
223
  CONV2(TYPE, -3.2 ## POSTFIX, _Sat long long _Fract, -0.5llr - 0.5llr) \
224
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned short _Fract, 1.0uhr) \
225
  CONV2(TYPE, -3.2 ## POSTFIX, _Sat unsigned short _Fract, 0.0uhr) \
226
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned _Fract, 1.0ur) \
227
  CONV2(TYPE, -3.2 ## POSTFIX, _Sat unsigned _Fract, 0.0ur) \
228
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned long _Fract, 1.0ulr) \
229
  CONV2(TYPE, -3.2 ## POSTFIX, _Sat unsigned long _Fract, 0.0ulr) \
230
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned long long _Fract, 1.0ullr) \
231
  CONV2(TYPE, -3.2 ## POSTFIX, _Sat unsigned long long _Fract, 0.0ullr) \
232
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat short _Fract, 1.0hr) \
233
  CONV2(TYPE, -1.0 ## POSTFIX, _Sat short _Fract, -0.5hr - 0.5hr) \
234
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat _Fract, 1.0r) \
235
  CONV2(TYPE, -1.0 ## POSTFIX, _Sat _Fract, -0.5r - 0.5r) \
236
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat long _Fract, 1.0lr) \
237
  CONV2(TYPE, -1.0 ## POSTFIX, _Sat long _Fract, -0.5lr - 0.5lr) \
238
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat long long _Fract, 1.0llr) \
239
  CONV2(TYPE, -1.0 ## POSTFIX, _Sat long long _Fract, -0.5llr - 0.5llr) \
240
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned short _Fract, 1.0uhr) \
241
  CONV2(TYPE, -1.0 ## POSTFIX, _Sat unsigned short _Fract, 0.0uhr) \
242
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned _Fract, 1.0ur) \
243
  CONV2(TYPE, -1.0 ## POSTFIX, _Sat unsigned _Fract, 0.0ur) \
244
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned long _Fract, 1.0ulr) \
245
  CONV2(TYPE, -1.0 ## POSTFIX, _Sat unsigned long _Fract, 0.0ulr) \
246
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned long long _Fract, 1.0ullr) \
247
  CONV2(TYPE, -1.0 ## POSTFIX, _Sat unsigned long long _Fract, 0.0ullr)
248
 
249
/* Unsigned accum to _Sat unsigned/signed fract.  */
250
#define SAT_CONV2(TYPE, POSTFIX) \
251
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat short _Fract, 1.0hr) \
252
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat _Fract, 1.0r) \
253
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat long _Fract, 1.0lr) \
254
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat long long _Fract, 1.0llr) \
255
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned short _Fract, 1.0uhr) \
256
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned _Fract, 1.0ur) \
257
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned long _Fract, 1.0ulr) \
258
  CONV2(TYPE, 3.2 ## POSTFIX, _Sat unsigned long long _Fract, 1.0ullr) \
259
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat short _Fract, 1.0hr) \
260
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat _Fract, 1.0r) \
261
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat long _Fract, 1.0lr) \
262
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat long long _Fract, 1.0llr) \
263
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned short _Fract, 1.0uhr) \
264
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned _Fract, 1.0ur) \
265
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned long _Fract, 1.0ulr) \
266
  CONV2(TYPE, 1.0 ## POSTFIX, _Sat unsigned long long _Fract, 1.0ullr)
267
 
268
/* Signed fract to _Sat unsigned fract.  */
269
#define SAT_CONV3(TYPE, POSTFIX) \
270
  CONV2(TYPE, -0.5 ## POSTFIX, _Sat unsigned short _Fract, 0.0uhr) \
271
  CONV2(TYPE, -0.5 ## POSTFIX, _Sat unsigned  _Fract, 0.0ur) \
272
  CONV2(TYPE, -0.5 ## POSTFIX, _Sat unsigned long _Fract, 0.0ulr) \
273
  CONV2(TYPE, -0.5 ## POSTFIX, _Sat unsigned long long _Fract, 0.0ullr)
274
 
275
/* Signed integer to _Sat signed/unsigned fract.  */
276
#define SAT_CONV4(TYPE) \
277
  CONV2(TYPE, 100, _Sat short _Fract, 1.0hr) \
278
  CONV2(TYPE, -100, _Sat short _Fract, -0.5hr - 0.5hr) \
279
  CONV2(TYPE, 100, _Sat _Fract, 1.0r) \
280
  CONV2(TYPE, -100, _Sat _Fract, -0.5r - 0.5r) \
281
  CONV2(TYPE, 100, _Sat long _Fract, 1.0lr) \
282
  CONV2(TYPE, -100, _Sat long _Fract, -0.5lr - 0.5lr) \
283
  CONV2(TYPE, 100, _Sat long long _Fract, 1.0llr) \
284
  CONV2(TYPE, -100, _Sat long long _Fract, -0.5llr - 0.5llr) \
285
  CONV2(TYPE, 100, _Sat unsigned short _Fract, 1.0uhr) \
286
  CONV2(TYPE, -100, _Sat unsigned short _Fract, 0.0uhr) \
287
  CONV2(TYPE, 100, _Sat unsigned _Fract, 1.0ur) \
288
  CONV2(TYPE, -100, _Sat unsigned _Fract, 0.0ur) \
289
  CONV2(TYPE, 100, _Sat unsigned long _Fract, 1.0ulr) \
290
  CONV2(TYPE, -100, _Sat unsigned long _Fract, 0.0ulr) \
291
  CONV2(TYPE, 100, _Sat unsigned long long _Fract, 1.0ullr) \
292
  CONV2(TYPE, -100, _Sat unsigned long long _Fract, 0.0ullr) \
293
  CONV2(TYPE, 1, _Sat short _Fract, 1.0hr) \
294
  CONV2(TYPE, -1, _Sat short _Fract, -0.5hr - 0.5hr) \
295
  CONV2(TYPE, 1, _Sat _Fract, 1.0r) \
296
  CONV2(TYPE, -1, _Sat _Fract, -0.5r - 0.5r) \
297
  CONV2(TYPE, 1, _Sat long _Fract, 1.0lr) \
298
  CONV2(TYPE, -1, _Sat long _Fract, -0.5lr - 0.5lr) \
299
  CONV2(TYPE, 1, _Sat long long _Fract, 1.0llr) \
300
  CONV2(TYPE, -1, _Sat long long _Fract, -0.5llr - 0.5llr) \
301
  CONV2(TYPE, 1, _Sat unsigned short _Fract, 1.0uhr) \
302
  CONV2(TYPE, -1, _Sat unsigned short _Fract, 0.0uhr) \
303
  CONV2(TYPE, 1, _Sat unsigned _Fract, 1.0ur) \
304
  CONV2(TYPE, -1, _Sat unsigned _Fract, 0.0ur) \
305
  CONV2(TYPE, 1, _Sat unsigned long _Fract, 1.0ulr) \
306
  CONV2(TYPE, -1, _Sat unsigned long _Fract, 0.0ulr) \
307
  CONV2(TYPE, 1, _Sat unsigned long long _Fract, 1.0ullr) \
308
  CONV2(TYPE, -1, _Sat unsigned long long _Fract, 0.0ullr)
309
 
310
/* Unsigned integer to _Sat signed/unsigned fract.  */
311
#define SAT_CONV5(TYPE) \
312
  CONV2(TYPE, 100, _Sat short _Fract, 1.0hr) \
313
  CONV2(TYPE, 100, _Sat _Fract, 1.0r) \
314
  CONV2(TYPE, 100, _Sat long _Fract, 1.0lr) \
315
  CONV2(TYPE, 100, _Sat long long _Fract, 1.0llr) \
316
  CONV2(TYPE, 100, _Sat unsigned short _Fract, 1.0uhr) \
317
  CONV2(TYPE, 100, _Sat unsigned _Fract, 1.0ur) \
318
  CONV2(TYPE, 100, _Sat unsigned long _Fract, 1.0ulr) \
319
  CONV2(TYPE, 100, _Sat unsigned long long _Fract, 1.0ullr) \
320
  CONV2(TYPE, 1, _Sat short _Fract, 1.0hr) \
321
  CONV2(TYPE, 1, _Sat _Fract, 1.0r) \
322
  CONV2(TYPE, 1, _Sat long _Fract, 1.0lr) \
323
  CONV2(TYPE, 1, _Sat long long _Fract, 1.0llr) \
324
  CONV2(TYPE, 1, _Sat unsigned short _Fract, 1.0uhr) \
325
  CONV2(TYPE, 1, _Sat unsigned _Fract, 1.0ur) \
326
  CONV2(TYPE, 1, _Sat unsigned long _Fract, 1.0ulr) \
327
  CONV2(TYPE, 1, _Sat unsigned long long _Fract, 1.0ullr)
328
 
329
/* Floating-point to _Sat signed/unsigned fract.  */
330
#define SAT_CONV6(TYPE) \
331
  CONV2(TYPE, 100.0, _Sat short _Fract, 1.0hr) \
332
  CONV2(TYPE, -100.0, _Sat short _Fract, -0.5hr - 0.5hr) \
333
  CONV2(TYPE, 100.0, _Sat _Fract, 1.0r) \
334
  CONV2(TYPE, -100.0, _Sat _Fract, -0.5r - 0.5r) \
335
  CONV2(TYPE, 100.0, _Sat long _Fract, 1.0lr) \
336
  CONV2(TYPE, -100.0, _Sat long _Fract, -0.5lr - 0.5lr) \
337
  CONV2(TYPE, 100.0, _Sat long long _Fract, 1.0llr) \
338
  CONV2(TYPE, -100.0, _Sat long long _Fract, -0.5llr - 0.5llr) \
339
  CONV2(TYPE, 100.0, _Sat unsigned short _Fract, 1.0uhr) \
340
  CONV2(TYPE, -100.0, _Sat unsigned short _Fract, 0.0uhr) \
341
  CONV2(TYPE, 100.0, _Sat unsigned _Fract, 1.0ur) \
342
  CONV2(TYPE, -100.0, _Sat unsigned _Fract, 0.0ur) \
343
  CONV2(TYPE, 100.0, _Sat unsigned long _Fract, 1.0ulr) \
344
  CONV2(TYPE, -100.0, _Sat unsigned long _Fract, 0.0ulr) \
345
  CONV2(TYPE, 100.0, _Sat unsigned long long _Fract, 1.0ullr) \
346
  CONV2(TYPE, -100.0, _Sat unsigned long long _Fract, 0.0ullr) \
347
  CONV2(TYPE, 1.0, _Sat short _Fract, 1.0hr) \
348
  CONV2(TYPE, -1.0, _Sat short _Fract, -0.5hr - 0.5hr) \
349
  CONV2(TYPE, 1.0, _Sat _Fract, 1.0r) \
350
  CONV2(TYPE, -1.0, _Sat _Fract, -0.5r - 0.5r) \
351
  CONV2(TYPE, 1.0, _Sat long _Fract, 1.0lr) \
352
  CONV2(TYPE, -1.0, _Sat long _Fract, -0.5lr - 0.5lr) \
353
  CONV2(TYPE, 1.0, _Sat long long _Fract, 1.0llr) \
354
  CONV2(TYPE, -1.0, _Sat long long _Fract, -0.5llr - 0.5llr) \
355
  CONV2(TYPE, 1.0, _Sat unsigned short _Fract, 1.0uhr) \
356
  CONV2(TYPE, -1.0, _Sat unsigned short _Fract, 0.0uhr) \
357
  CONV2(TYPE, 1.0, _Sat unsigned _Fract, 1.0ur) \
358
  CONV2(TYPE, -1.0, _Sat unsigned _Fract, 0.0ur) \
359
  CONV2(TYPE, 1.0, _Sat unsigned long _Fract, 1.0ulr) \
360
  CONV2(TYPE, -1.0, _Sat unsigned long _Fract, 0.0ulr) \
361
  CONV2(TYPE, 1.0, _Sat unsigned long long _Fract, 1.0ullr) \
362
  CONV2(TYPE, -1.0, _Sat unsigned long long _Fract, 0.0ullr)
363
 
364
int main ()
365
{
366
  ALL_CONV (short _Fract, hr);
367
  ALL_CONV (_Fract, r);
368
  ALL_CONV (long _Fract, lr);
369
  ALL_CONV (long long _Fract, llr);
370
  ALL_CONV (unsigned short _Fract, uhr);
371
  ALL_CONV (unsigned _Fract, ur);
372
  ALL_CONV (unsigned long _Fract, ulr);
373
  ALL_CONV (unsigned long long _Fract, ullr);
374
  ALL_CONV (short _Accum, hk);
375
  ALL_CONV (_Accum, k);
376
  ALL_CONV (long _Accum, lk);
377
  ALL_CONV (long long _Accum, llk);
378
  ALL_CONV (unsigned short _Accum, uhk);
379
  ALL_CONV (unsigned _Accum, uk);
380
  ALL_CONV (unsigned long _Accum, ulk);
381
  ALL_CONV (unsigned long long _Accum, ullk);
382
 
383
  ALL_ACCUM_CONV (short _Accum, hk);
384
  ALL_ACCUM_CONV (_Accum, k);
385
  ALL_ACCUM_CONV (long _Accum, lk);
386
  ALL_ACCUM_CONV (long long _Accum, llk);
387
  ALL_ACCUM_CONV (unsigned short _Accum, uhk);
388
  ALL_ACCUM_CONV (unsigned _Accum, uk);
389
  ALL_ACCUM_CONV (unsigned long _Accum, ulk);
390
  ALL_ACCUM_CONV (unsigned long long _Accum, ullk);
391
 
392
  NEG_CONV (short _Fract, hr);
393
  NEG_CONV (_Fract, r);
394
  NEG_CONV (long _Fract, lr);
395
  NEG_CONV (long long _Fract, llr);
396
  NEG_CONV (short _Accum, hk);
397
  NEG_CONV (_Accum, k);
398
  NEG_CONV (long _Accum, lk);
399
  NEG_CONV (long long _Accum, llk);
400
 
401
  SAT_CONV1 (short _Accum, hk);
402
  SAT_CONV1 (_Accum, k);
403
  SAT_CONV1 (long _Accum, lk);
404
  SAT_CONV1 (long long _Accum, llk);
405
 
406
  SAT_CONV2 (unsigned short _Accum, uhk);
407
  SAT_CONV2 (unsigned _Accum, uk);
408
  SAT_CONV2 (unsigned long _Accum, ulk);
409
  SAT_CONV2 (unsigned long long _Accum, ullk);
410
 
411
  SAT_CONV3 (short _Fract, hr);
412
  SAT_CONV3 (_Fract, r);
413
  SAT_CONV3 (long _Fract, lr);
414
  SAT_CONV3 (long long _Fract, llr);
415
 
416
  SAT_CONV4 (signed char);
417
  SAT_CONV4 (short);
418
  SAT_CONV4 (int);
419
  SAT_CONV4 (long);
420
  SAT_CONV4 (long long);
421
 
422
  SAT_CONV5 (unsigned char);
423
  SAT_CONV5 (unsigned short);
424
  SAT_CONV5 (unsigned int);
425
  SAT_CONV5 (unsigned long);
426
  SAT_CONV5 (unsigned long long);
427
 
428
  SAT_CONV6 (float);
429
  SAT_CONV6 (double);
430
 
431
  return 0;
432
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.