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

/runtime/typeinfo/ti_delegate.d

http://github.com/wilkie/djehuty
D | 40 lines | 23 code | 11 blank | 6 comment | 1 complexity | 51655c1db69a6609a3de1e31a515a0d2 MD5 | raw file
 1/*
 2 * ti_delegate.d
 3 *
 4 * This module implements the TypeInfo for the delegate type.
 5 *
 6 */
 7
 8module runtime.typeinfo.ti_delegate;
 9
10class TypeInfo_Delegate : TypeInfo {
11	hash_t getHash(void *p) {
12		long l = *cast(long *)p;
13
14		return cast(uint)(l + (l >> 32));
15	}
16
17	int equals(void *p1, void *p2) {
18		return *cast(dg *)p1 == *cast(dg *)p2;
19	}
20
21	size_t tsize() {
22		return dg.sizeof;
23	}
24
25	void swap(void *p1, void *p2) {
26		dg t;
27
28		t = *cast(dg *)p1;
29		*cast(dg *)p1 = *cast(dg *)p2;
30		*cast(dg *)p2 = t;
31	}
32
33	uint flags() {
34		return 1;
35	}
36
37	private alias void delegate(int) dg;
38
39}
40