1 /*
2 * Copyright (C) 2004-2005 by Digital Mars, www.digitalmars.com
3 * Written by Walter Bright
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, in both source and binary form, subject to the following
12 * restrictions:
13 *
14 * o The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this software
16 * in a product, an acknowledgment in the product documentation would be
17 * appreciated but is not required.
18 * o Altered source versions must be plainly marked as such, and must not
19 * be misrepresented as being the original software.
20 * o This notice may not be removed or altered from any source
21 * distribution.
22 */23 24 modulert.compiler.ldc.typeinfo.ti_C;
25 26 // Object27 28 classTypeInfo_C : TypeInfo29 {
30 overridehash_tgetHash(invoid* p)
31 {
32 Objecto = *cast(Object*)p;
33 returno ? o.toHash() : cast(hash_t)0xdeadbeef;
34 }
35 36 overrideequals_tequals(invoid* p1, invoid* p2)
37 {
38 Objecto1 = *cast(Object*)p1;
39 Objecto2 = *cast(Object*)p2;
40 41 returno1 == o2;
42 }
43 44 overrideintcompare(invoid* p1, invoid* p2)
45 {
46 Objecto1 = *cast(Object*)p1;
47 Objecto2 = *cast(Object*)p2;
48 intc = 0;
49 50 // Regard null references as always being "less than"51 if (!(o1iso2))
52 {
53 if (o1)
54 { if (!o2)
55 c = 1;
56 else57 c = o1.opCmp(o2);
58 }
59 else60 c = -1;
61 }
62 returnc;
63 }
64 65 overridesize_ttalign()
66 {
67 returnObject.alignof;
68 }
69 70 overridesize_ttsize()
71 {
72 returnObject.sizeof;
73 }
74 75 overrideuintflags()
76 {
77 return1;
78 }
79 }