]> git.ipfire.org Git - thirdparty/gcc.git/blob - libphobos/libdruntime/rt/typeinfo/ti_float.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / libphobos / libdruntime / rt / typeinfo / ti_float.d
1 /**
2 * TypeInfo support code.
3 *
4 * Copyright: Copyright Digital Mars 2004 - 2009.
5 * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6 * Authors: Walter Bright
7 */
8
9 /* Copyright Digital Mars 2004 - 2009.
10 * Distributed under the Boost Software License, Version 1.0.
11 * (See accompanying file LICENSE or copy at
12 * http://www.boost.org/LICENSE_1_0.txt)
13 */
14 module rt.typeinfo.ti_float;
15
16 private import rt.util.typeinfo;
17
18 // float
19
20 class TypeInfo_f : TypeInfo
21 {
22 pure:
23 nothrow:
24 @safe:
25
26 alias F = float;
27
28 override string toString() const { return F.stringof; }
29
30 override size_t getHash(in void* p) const @trusted
31 {
32 return Floating!F.hashOf(*cast(F*)p);
33 }
34
35 override bool equals(in void* p1, in void* p2) const @trusted
36 {
37 return Floating!F.equals(*cast(F*)p1, *cast(F*)p2);
38 }
39
40 override int compare(in void* p1, in void* p2) const @trusted
41 {
42 return Floating!F.compare(*cast(F*)p1, *cast(F*)p2);
43 }
44
45 override @property size_t tsize() const
46 {
47 return F.sizeof;
48 }
49
50 override void swap(void *p1, void *p2) const @trusted
51 {
52 F t = *cast(F*)p1;
53 *cast(F*)p1 = *cast(F*)p2;
54 *cast(F*)p2 = t;
55 }
56
57 override const(void)[] initializer() const @trusted
58 {
59 static immutable F r;
60 return (&r)[0 .. 1];
61 }
62
63 version (Windows)
64 {
65 }
66 else version (X86_64)
67 {
68 // 2 means arg to function is passed in XMM registers
69 override @property uint flags() const { return 2; }
70 }
71 }