diff lphobos/typeinfo/ti_ubyte.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_ubyte.d@c53b6e3fe49a
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lphobos/typeinfo/ti_ubyte.d	Tue Oct 23 05:55:12 2007 +0200
@@ -0,0 +1,43 @@
+
+// ubyte
+
+module typeinfo.ti_ubyte;
+
+class TypeInfo_h : TypeInfo
+{
+    char[] toString() { return "ubyte"; }
+
+    hash_t getHash(void *p)
+    {
+	return *cast(ubyte *)p;
+    }
+
+    int equals(void *p1, void *p2)
+    {
+	return *cast(ubyte *)p1 == *cast(ubyte *)p2;
+    }
+
+    int compare(void *p1, void *p2)
+    {
+	return *cast(ubyte *)p1 - *cast(ubyte *)p2;
+    }
+
+    size_t tsize()
+    {
+	return ubyte.sizeof;
+    }
+
+    void swap(void *p1, void *p2)
+    {
+	ubyte t;
+
+	t = *cast(ubyte *)p1;
+	*cast(ubyte *)p1 = *cast(ubyte *)p2;
+	*cast(ubyte *)p2 = t;
+    }
+}
+
+class TypeInfo_b : TypeInfo_h
+{
+    char[] toString() { return "bool"; }
+}