comparison druntime/src/compiler/dmd/typeinfo/ti_ulong.d @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 /**
2 * TypeInfo support code.
3 *
4 * Copyright: Copyright Digital Mars 2004 - 2009.
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>.
6 * Authors: Walter Bright
7 *
8 * Copyright Digital Mars 2004 - 2009.
9 * Distributed under the Boost Software License, Version 1.0.
10 * (See accompanying file LICENSE_1_0.txt or copy at
11 * http://www.boost.org/LICENSE_1_0.txt)
12 */
13 module rt.typeinfo.ti_ulong;
14
15 // ulong
16
17 class TypeInfo_m : TypeInfo
18 {
19 override string toString() { return "ulong"; }
20
21 override hash_t getHash(in void* p)
22 {
23 return *cast(uint *)p + (cast(uint *)p)[1];
24 }
25
26 override equals_t equals(in void* p1, in void* p2)
27 {
28 return *cast(ulong *)p1 == *cast(ulong *)p2;
29 }
30
31 override int compare(in void* p1, in void* p2)
32 {
33 if (*cast(ulong *)p1 < *cast(ulong *)p2)
34 return -1;
35 else if (*cast(ulong *)p1 > *cast(ulong *)p2)
36 return 1;
37 return 0;
38 }
39
40 override size_t tsize()
41 {
42 return ulong.sizeof;
43 }
44
45 override void swap(void *p1, void *p2)
46 {
47 ulong t;
48
49 t = *cast(ulong *)p1;
50 *cast(ulong *)p1 = *cast(ulong *)p2;
51 *cast(ulong *)p2 = t;
52 }
53 }