Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/runtime/internal/typeinfo/ti_ptr.d Fri Aug 01 00:32:06 2008 +0200 @@ -0,0 +1,46 @@ + +// pointer + +module typeinfo.ti_ptr; + +class TypeInfo_P : TypeInfo +{ + hash_t getHash(void *p) + { + return cast(uint)*cast(void* *)p; + } + + int equals(void *p1, void *p2) + { + return *cast(void* *)p1 == *cast(void* *)p2; + } + + int compare(void *p1, void *p2) + { + auto c = *cast(void* *)p1 - *cast(void* *)p2; + if (c < 0) + return -1; + else if (c > 0) + return 1; + return 0; + } + + size_t tsize() + { + return (void*).sizeof; + } + + void swap(void *p1, void *p2) + { + void* t; + + t = *cast(void* *)p1; + *cast(void* *)p1 = *cast(void* *)p2; + *cast(void* *)p2 = t; + } + + uint flags() + { + return 1; + } +}