PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/runtime/typeinfo/ti_void.d

http://github.com/wilkie/djehuty
D | 42 lines | 27 code | 9 blank | 6 comment | 1 complexity | ad41a3d497c7d1c5e6bf41fa3931309a MD5 | raw file
 1/*
 2 * ti_void.d
 3 *
 4 * This module implements the TypeInfo for the void type.
 5 *
 6 */
 7
 8module runtime.typeinfo.ti_void;
 9
10class TypeInfo_v : TypeInfo {
11	char[] toString() {
12		return "void";
13	}
14
15	hash_t getHash(void *p) {
16		assert(0);
17	}
18
19	int equals(void *p1, void *p2) {
20		return *cast(byte *)p1 == *cast(byte *)p2;
21	}
22
23	int compare(void *p1, void *p2) {
24		return *cast(byte *)p1 - *cast(byte *)p2;
25	}
26
27	size_t tsize() {
28		return void.sizeof;
29	}
30
31	void swap(void *p1, void *p2) {
32		byte t;
33
34		t = *cast(byte *)p1;
35		*cast(byte *)p1 = *cast(byte *)p2;
36		*cast(byte *)p2 = t;
37	}
38
39	uint flags() {
40		return 1;
41	}
42}