annotate dmd/ComplexExp.d @ 175:94b6033c07f3

get rid of globals malloc -> GC.malloc
author korDen
date Sun, 10 Oct 2010 03:48:06 +0400
parents af724d3510d7
children e3afd1303184
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
1 module dmd.ComplexExp;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 72
diff changeset
3 import dmd.common;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
4 import dmd.Expression;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
5 import dmd.InterState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
6 import dmd.Type;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
7 import dmd.OutBuffer;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
8 import dmd.Loc;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
9 import dmd.Scope;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
10 import dmd.IRState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
11 import dmd.HdrGenState;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.Type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 import dmd.TOK;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 import dmd.TY;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.Port;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.Complex;
129
010eb8f0e18d further work on dmd test suite
korDen
parents: 123
diff changeset
17 import dmd.expression.Util;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
18
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
19 import dmd.backend.dt_t;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.backend.elem;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 import dmd.backend.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 import dmd.backend.TYM;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 import dmd.backend.mTY;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
24
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 class ComplexExp : Expression
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 Complex!(real) value;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 this(Loc loc, Complex!(real) value, Type type)
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
30 {
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 super(loc, TOK.TOKcomplex80, ComplexExp.sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 this.value = value;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 this.type = type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 //printf("ComplexExp.ComplexExp(%s)\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
37 override bool equals(Object o)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
42 override Expression semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 if (!type)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 type = Type.tcomplex80;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 type = type.semantic(loc, sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
51 override Expression interpret(InterState istate)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
56 override string toChars()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
61 override ulong toInteger()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 return cast(ulong) toReal();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
66 override ulong toUInteger()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 return cast(long) toReal();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
71 override real toReal()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 return value.re;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
76 override real toImaginary()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 return value.im;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
81 override Complex!(real) toComplex()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 return value;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
86 override Expression castTo(Scope sc, Type t)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 Expression e = this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 if (type != t)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91 if (type.iscomplex() && t.iscomplex())
174
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
92 {
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 e = copy();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 e.type = t;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 e = Expression.castTo(sc, t);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
102 override int isConst()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 {
53
a8b50ff7f201 ForeachStatement.syntaxCopy
korDen
parents: 45
diff changeset
104 return 1;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
107 override bool isBool(bool result)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 {
123
9e39c7de8438 Make dmd test suite compile
korDen
parents: 114
diff changeset
109 if (result)
9e39c7de8438 Make dmd test suite compile
korDen
parents: 114
diff changeset
110 return value != Complex!(real).zero;
9e39c7de8438 Make dmd test suite compile
korDen
parents: 114
diff changeset
111 else
9e39c7de8438 Make dmd test suite compile
korDen
parents: 114
diff changeset
112 return value == Complex!(real).zero;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
115 override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 {
174
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
117 /* Print as:
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
118 * (re+imi)
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
119 */
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
120 version (IN_GCC) {
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
121 char buf1[sizeof(value) * 3 + 8 + 1];
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
122 char buf2[sizeof(value) * 3 + 8 + 1];
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
123 creall(value).format(buf1, sizeof(buf1));
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
124 cimagl(value).format(buf2, sizeof(buf2));
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
125 buf.printf("(%s+%si)", buf1, buf2);
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
126 } else {
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
127 buf.writeByte('(');
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
128 floatToBuffer(buf, type, value.re);
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
129 buf.writeByte('+');
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
130 floatToBuffer(buf, type, value.im);
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
131 buf.writestring("i)");
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
132 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
135 override void toMangleBuffer(OutBuffer buf)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 {
129
010eb8f0e18d further work on dmd test suite
korDen
parents: 123
diff changeset
137 buf.writeByte('c');
010eb8f0e18d further work on dmd test suite
korDen
parents: 123
diff changeset
138 real r = toReal();
010eb8f0e18d further work on dmd test suite
korDen
parents: 123
diff changeset
139 realToMangleBuffer(buf, r);
010eb8f0e18d further work on dmd test suite
korDen
parents: 123
diff changeset
140 buf.writeByte('c'); // separate the two
010eb8f0e18d further work on dmd test suite
korDen
parents: 123
diff changeset
141 r = toImaginary();
010eb8f0e18d further work on dmd test suite
korDen
parents: 123
diff changeset
142 realToMangleBuffer(buf, r);
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143 }
174
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
144
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 version (_DH) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 OutBuffer hexp;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
149 override elem* toElem(IRState* irs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 eve c;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 tym_t ty;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154 //printf("ComplexExp.toElem(%p) %s\n", this, toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 ///memset(&c, 0, c.sizeof);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 ty = type.totym();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159 switch (tybasic(ty))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 case TYcfloat:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163 c.Vcfloat.re = cast(float) value.re;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
164 if (Port.isSignallingNan(value.re)) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 (cast(uint*)&c.Vcfloat.re)[0] &= 0xFFBFFFFFL;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 std.stdio.writeln("float.re is snan");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 c.Vcfloat.im = cast(float) value.im;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 if (Port.isSignallingNan(value.im)) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170 (cast(uint*)&c.Vcfloat.im)[0] &= 0xFFBFFFFFL;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 std.stdio.writeln("float.im is snan");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 case TYcdouble:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 c.Vcdouble.re = cast(double) value.re;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179 if (Port.isSignallingNan(value.re)) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 std.stdio.writeln("double.re is snan");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 (cast(uint*)&c.Vcdouble.re)[1] &= 0xFFF7FFFFL;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 c.Vcdouble.im = cast(double) value.im;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 if (Port.isSignallingNan(value.im)) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 (cast(uint*)&c.Vcdouble.im)[1] &= 0xFFF7FFFFL;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186 std.stdio.writeln("double.im is snan");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 case TYcldouble:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 static if (true) {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194 c.Vcldouble = value;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195 } else {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
197 ushort* p = cast(ushort*)&c.Vcldouble;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 for (int i = 0; i < (LNGDBLSIZE*2)/2; i++) printf("%04x ", p[i]);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199 printf("\n");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201 c.Vcldouble.im = im;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 ushort* p = cast(ushort*)&c.Vcldouble;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 for (int i = 0; i < (LNGDBLSIZE*2)/2; i++) printf("%04x ", p[i]);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205 printf("\n");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207 c.Vcldouble.re = re;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209 ushort* p = cast(ushort*)&c.Vcldouble;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 for (int i = 0; i < (LNGDBLSIZE*2)/2; i++) printf("%04x ", p[i]);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 printf("\n");
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 default:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
218 assert(0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
219 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220 return el_const(ty, &c);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 }
174
af724d3510d7 lot os toCBuffer methods implemented
korDen
parents: 129
diff changeset
222
175
94b6033c07f3 get rid of globals
korDen
parents: 174
diff changeset
223 static private __gshared char[6] zeropad;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
224
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
225 override dt_t** toDt(dt_t** pdt)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227 //printf("ComplexExp.toDt() '%s'\n", toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
228 float fvalue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
229 double dvalue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 real evalue;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232 switch (type.toBasetype().ty)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
233 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
234 case Tcomplex32:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 fvalue = value.re;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 pdt = dtnbytes(pdt,4,cast(char*)&fvalue);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237 fvalue = value.im;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 pdt = dtnbytes(pdt,4,cast(char*)&fvalue);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
241 case Tcomplex64:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
242 dvalue = value.re;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
243 pdt = dtnbytes(pdt,8,cast(char*)&dvalue);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
244 dvalue = value.im;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
245 pdt = dtnbytes(pdt,8,cast(char*)&dvalue);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
246 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
247
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
248 case Tcomplex80:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
249 evalue = value.re;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
250 pdt = dtnbytes(pdt,REALSIZE - REALPAD,cast(char*)&evalue);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
251 pdt = dtnbytes(pdt,REALPAD,zeropad.ptr);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
252 evalue = value.im;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
253 pdt = dtnbytes(pdt,REALSIZE - REALPAD, cast(char*)&evalue);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
254 pdt = dtnbytes(pdt,REALPAD,zeropad.ptr);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
255 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
256
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
257 default:
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
258 assert(0);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
259 break;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
260 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
261 return pdt;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
262 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
263 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
264