Mercurial > projects > ldc
comparison runtime/internal/typeinfo/ti_ptr.d @ 443:44f08170f4ef
Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Reworked the LLVMDC specific pragmas.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Fri, 01 Aug 2008 00:32:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
442:76078c8ab5b9 | 443:44f08170f4ef |
---|---|
1 | |
2 // pointer | |
3 | |
4 module typeinfo.ti_ptr; | |
5 | |
6 class TypeInfo_P : TypeInfo | |
7 { | |
8 hash_t getHash(void *p) | |
9 { | |
10 return cast(uint)*cast(void* *)p; | |
11 } | |
12 | |
13 int equals(void *p1, void *p2) | |
14 { | |
15 return *cast(void* *)p1 == *cast(void* *)p2; | |
16 } | |
17 | |
18 int compare(void *p1, void *p2) | |
19 { | |
20 auto c = *cast(void* *)p1 - *cast(void* *)p2; | |
21 if (c < 0) | |
22 return -1; | |
23 else if (c > 0) | |
24 return 1; | |
25 return 0; | |
26 } | |
27 | |
28 size_t tsize() | |
29 { | |
30 return (void*).sizeof; | |
31 } | |
32 | |
33 void swap(void *p1, void *p2) | |
34 { | |
35 void* t; | |
36 | |
37 t = *cast(void* *)p1; | |
38 *cast(void* *)p1 = *cast(void* *)p2; | |
39 *cast(void* *)p2 = t; | |
40 } | |
41 | |
42 uint flags() | |
43 { | |
44 return 1; | |
45 } | |
46 } |