Mercurial > projects > ldc
comparison tango/lib/compiler/llvmdc/typeinfo/ti_ptr.d @ 132:1700239cab2e trunk
[svn r136] MAJOR UNSTABLE UPDATE!!!
Initial commit after moving to Tango instead of Phobos.
Lots of bugfixes...
This build is not suitable for most things.
author | lindquist |
---|---|
date | Fri, 11 Jan 2008 17:57:40 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:5825d48b27d1 | 132:1700239cab2e |
---|---|
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 } |