Mercurial > projects > ldc
diff lphobos/typeinfo/ti_uint.d @ 52:0c77619e803b trunk
[svn r56] Initial support for TypeInfo.
Enums not work.
Several other bugfixes.
author | lindquist |
---|---|
date | Tue, 23 Oct 2007 05:55:12 +0200 |
parents | lphobos/std/typeinfo/ti_uint.d@c53b6e3fe49a |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lphobos/typeinfo/ti_uint.d Tue Oct 23 05:55:12 2007 +0200 @@ -0,0 +1,43 @@ + +// uint + +module typeinfo.ti_uint; + +class TypeInfo_k : TypeInfo +{ + char[] toString() { return "uint"; } + + hash_t getHash(void *p) + { + return *cast(uint *)p; + } + + int equals(void *p1, void *p2) + { + return *cast(uint *)p1 == *cast(uint *)p2; + } + + int compare(void *p1, void *p2) + { + if (*cast(uint*) p1 < *cast(uint*) p2) + return -1; + else if (*cast(uint*) p1 > *cast(uint*) p2) + return 1; + return 0; + } + + size_t tsize() + { + return uint.sizeof; + } + + void swap(void *p1, void *p2) + { + int t; + + t = *cast(uint *)p1; + *cast(uint *)p1 = *cast(uint *)p2; + *cast(uint *)p2 = t; + } +} +