PageRenderTime 22ms CodeModel.GetById 7ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/runtime/typeinfo/ti_dchar.d

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