annotate lphobos/typeinfo1/ti_cfloat.d @ 1602:a413ae7329bf

Merge DMD r243: some harmonization with D2 dmd --- dmd/aggregate.h | 24 ++++- dmd/attrib.c | 63 ++++++---- dmd/attrib.h | 10 +- dmd/declaration.h | 5 +- dmd/func.c | 337 ++++++++++++++++++++++------------------------------- dmd/mars.c | 2 +- dmd/mars.h | 7 + dmd/mtype.h | 13 ++- dmd/parse.c | 32 ++++- dmd/parse.h | 14 ++- dmd/scope.h | 2 +- 11 files changed, 263 insertions(+), 246 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:19 -0300
parents 79c9ac745fbc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
107
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
1
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
2 // cfloat
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
3
119
79c9ac745fbc [svn r123] Fixed some typeinfo module name mismatches.
lindquist
parents: 107
diff changeset
4 module typeinfo1.ti_cfloat;
107
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
5
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
6 class TypeInfo_q : TypeInfo
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
7 {
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
8 char[] toString() { return "cfloat"; }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
9
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
10 hash_t getHash(void *p)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
11 {
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
12 return (cast(uint *)p)[0] + (cast(uint *)p)[1];
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
13 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
14
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
15 static int _equals(cfloat f1, cfloat f2)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
16 {
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
17 return f1 == f2;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
18 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
19
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
20 static int _compare(cfloat f1, cfloat f2)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
21 { int result;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
22
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
23 if (f1.re < f2.re)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
24 result = -1;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
25 else if (f1.re > f2.re)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
26 result = 1;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
27 else if (f1.im < f2.im)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
28 result = -1;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
29 else if (f1.im > f2.im)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
30 result = 1;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
31 else
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
32 result = 0;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
33 return result;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
34 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
35
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
36 int equals(void *p1, void *p2)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
37 {
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
38 return _equals(*cast(cfloat *)p1, *cast(cfloat *)p2);
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
39 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
40
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
41 int compare(void *p1, void *p2)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
42 {
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
43 return _compare(*cast(cfloat *)p1, *cast(cfloat *)p2);
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
44 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
45
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
46 size_t tsize()
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
47 {
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
48 return cfloat.sizeof;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
49 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
50
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
51 void swap(void *p1, void *p2)
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
52 {
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
53 cfloat t;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
54
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
55 t = *cast(cfloat *)p1;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
56 *cast(cfloat *)p1 = *cast(cfloat *)p2;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
57 *cast(cfloat *)p2 = t;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
58 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
59
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
60 void[] init()
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
61 { static cfloat r;
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
62
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
63 return (cast(cfloat *)&r)[0 .. 1];
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
64 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
65 }
3efbcc81ba45 [svn r111] Fixed most problems with complex number support and added typeinfo for them.
lindquist
parents:
diff changeset
66