comparison tests/mini/sextzext.d @ 445:cc40db549aea

Changed the handling of variadic intrinsics a bit. Removed the -fp80 option and made real be 80bit floats on X86, this is what the D spec really says it should be and fixes a bunch of issues. Changed the handling of parameter attributes to a bit more generalized approach. Added sext/zext attributes for byte/short/ubyte/ushort parameters, fixes #60 . Parameter attribs now properly set for intrinsic calls if necessary. Made the tango.math.Math patch less intrusive. Fixed/added some mini tests.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Fri, 01 Aug 2008 17:59:58 +0200
parents
children
comparison
equal deleted inserted replaced
444:f2b5f86348ef 445:cc40db549aea
1 module mini.sextzext;
2
3 void main()
4 {
5 byte sb = sextreturn1();
6 short ss = sextreturn2();
7 assert(ss == -2);
8 assert(sb == -2);
9 assert(sextparam1(-42) == -42);
10 assert(sextparam2(-42) == -42);
11
12 ubyte ub = zextreturn1();
13 ushort us = zextreturn2();
14 assert(ub == 2);
15 assert(us == 2);
16 assert(zextparam1(42) == 42);
17 assert(zextparam2(42) == 42);
18
19 assert(getchar() == 'a');
20 assert(passchar('z') == 'z');
21
22 }
23
24 byte sextreturn1()
25 {
26 return -2;
27 }
28 short sextreturn2()
29 {
30 return -2;
31 }
32
33 ubyte zextreturn1()
34 {
35 return 2;
36 }
37 ushort zextreturn2()
38 {
39 return 2;
40 }
41
42 byte sextparam1(byte b)
43 {
44 return b;
45 }
46 short sextparam2(short s)
47 {
48 return s;
49 }
50
51 ubyte zextparam1(ubyte b)
52 {
53 return b;
54 }
55 ushort zextparam2(ushort s)
56 {
57 return s;
58 }
59
60 char getchar()
61 {
62 return 'a';
63 }
64
65 char passchar(char ch)
66 {
67 return ch;
68 }