annotate lphobos/std/typeinfounsupported/ti_creal.d @ 1:c53b6e3fe49a trunk

[svn r5] Initial commit. Most things are very rough.
author lindquist
date Sat, 01 Sep 2007 21:43:27 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
2 // creal
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
3
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
4 module std.typeinfo.ti_creal;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
5
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
6 class TypeInfo_c : TypeInfo
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
7 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
8 char[] toString() { return "creal"; }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
9
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
10 hash_t getHash(void *p)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
11 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
12 return (cast(uint *)p)[0] + (cast(uint *)p)[1] +
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
13 (cast(uint *)p)[2] + (cast(uint *)p)[3] +
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
14 (cast(uint *)p)[4];
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
15 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
16
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
17 static int _equals(creal f1, creal f2)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
18 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
19 return f1 == f2;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
20 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
21
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
22 static int _compare(creal f1, creal f2)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
23 { int result;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
24
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
25 if (f1.re < f2.re)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
26 result = -1;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
27 else if (f1.re > f2.re)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
28 result = 1;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
29 else if (f1.im < f2.im)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
30 result = -1;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
31 else if (f1.im > f2.im)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
32 result = 1;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
33 else
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
34 result = 0;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
35 return result;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
36 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
37
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
38 int equals(void *p1, void *p2)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
39 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
40 return _equals(*cast(creal *)p1, *cast(creal *)p2);
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
41 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
42
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
43 int compare(void *p1, void *p2)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
44 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
45 return _compare(*cast(creal *)p1, *cast(creal *)p2);
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
46 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
47
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
48 size_t tsize()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
49 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
50 return creal.sizeof;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
51 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
52
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
53 void swap(void *p1, void *p2)
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
54 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
55 creal t;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
56
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
57 t = *cast(creal *)p1;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
58 *cast(creal *)p1 = *cast(creal *)p2;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
59 *cast(creal *)p2 = t;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
60 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
61
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
62 void[] init()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
63 { static creal r;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
64
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
65 return (cast(creal *)&r)[0 .. 1];
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
66 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
67 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
68