blob: a6987b7c0c583b43ff0b208eafd366a485b9de48 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import "all.hff";
fn hashtype(ty *const Type) u32 {
let h = FNV1A_INI;
h = fnv1a_i(h, ty.konst ? 1 : 0);
switch ty.u {
case Void; case Bool;
case Flo;
h = fnv1a_i(h, ty.size);
h = fnv1a_i(h, ty.align);
case Int i;
h = fnv1a_i(h, i.sgn ? 1 : 0);
h = fnv1a_i(h, ty.size);
h = fnv1a_i(h, ty.align);
case Ptr child;
h = fnv1a_i(h, child.id);
case Arr arr;
h = fnv1a_i(h, arr.child.id);
h = fnv1a_i(h, arr.length);
case Slice child;
h = fnv1a_i(h, child.id);
}
return h;
}
|