PageRenderTime 33ms CodeModel.GetById 19ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/runtime/typeinfo/ti_short.d

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