1 typedef _Bool bool;
2 typedef unsigned char uchar;
3 typedef unsigned short ushort;
4 typedef unsigned int uint;
5 typedef unsigned long ulong;
6 typedef long long longlong;
7 typedef unsigned long long ulonglong;
8
9 #define DEFINE_CAST(from, to) \
10 static to from##2##to(from x) { \
11 return x; \
12 }
13
14 #define DEFINE_CASTS(from) \
15 DEFINE_CAST(from, bool) \
16 DEFINE_CAST(from, char) \
17 DEFINE_CAST(from, uchar) \
18 DEFINE_CAST(from, short) \
19 DEFINE_CAST(from, ushort) \
20 DEFINE_CAST(from, int) \
21 DEFINE_CAST(from, uint) \
22 DEFINE_CAST(from, long) \
23 DEFINE_CAST(from, ulong) \
24 DEFINE_CAST(from, longlong) \
25 DEFINE_CAST(from, ulonglong) \
26 /*
27 DEFINE_CAST(from, float) \
28 DEFINE_CAST(from, double)
29 */
30
31 DEFINE_CASTS(bool)
32 DEFINE_CASTS(char)
33 DEFINE_CASTS(uchar)
34 DEFINE_CASTS(short)
35 DEFINE_CASTS(ushort)
36 DEFINE_CASTS(int)
37 DEFINE_CASTS(uint)
38 DEFINE_CASTS(long)
39 DEFINE_CASTS(ulong)
40 DEFINE_CASTS(longlong)
41 DEFINE_CASTS(ulonglong)
42 /*
43 DEFINE_CASTS(float)
44 DEFINE_CASTS(double)
45 */
46
47 /*
48 * check-name: Cast code generation
49 * check-command: sparsec -c $file -o tmp.o
50 */
|
1 typedef _Bool bool;
2 typedef signed char schar;
3 typedef unsigned char uchar;
4 typedef unsigned short ushort;
5 typedef unsigned int uint;
6 typedef unsigned long ulong;
7 typedef long long longlong;
8 typedef unsigned long long ulonglong;
9
10 #define DEFINE_CAST(from, to) \
11 static to from##2##to(from x) { \
12 return x; \
13 }
14
15 #define DEFINE_CASTS(from) \
16 DEFINE_CAST(from, bool) \
17 DEFINE_CAST(from, char) \
18 DEFINE_CAST(from, schar) \
19 DEFINE_CAST(from, uchar) \
20 DEFINE_CAST(from, short) \
21 DEFINE_CAST(from, ushort) \
22 DEFINE_CAST(from, int) \
23 DEFINE_CAST(from, uint) \
24 DEFINE_CAST(from, long) \
25 DEFINE_CAST(from, ulong) \
26 DEFINE_CAST(from, longlong) \
27 DEFINE_CAST(from, ulonglong) \
28 DEFINE_CAST(from, float) \
29 DEFINE_CAST(from, double)
30
31 DEFINE_CASTS(bool)
32 DEFINE_CASTS(char)
33 DEFINE_CASTS(schar)
34 DEFINE_CASTS(uchar)
35 DEFINE_CASTS(short)
36 DEFINE_CASTS(ushort)
37 DEFINE_CASTS(int)
38 DEFINE_CASTS(uint)
39 DEFINE_CASTS(long)
40 DEFINE_CASTS(ulong)
41 DEFINE_CASTS(longlong)
42 DEFINE_CASTS(ulonglong)
43 DEFINE_CASTS(float)
44 DEFINE_CASTS(double)
45
46 /*
47 * check-name: Cast code generation
48 * check-command: sparsec -c $file -o tmp.o
49 */
|