2 module rt.typeinfo.ti_Aint;
4 private import stdc.string;
8 class TypeInfo_Ai : TypeInfo
10 override string toString() { return "int[]"; }
12 override hash_t getHash(in void* p)
13 { int[] s = *cast(int[]*)p;
21 hash += *cast(uint *)str;
29 override equals_t equals(in void* p1, in void* p2)
31 int[] s1 = *cast(int[]*)p1;
32 int[] s2 = *cast(int[]*)p2;
34 return s1.length == s2.length &&
35 memcmp(cast(void *)s1, cast(void *)s2, s1.length * int.sizeof) == 0;
38 override int compare(in void* p1, in void* p2)
40 int[] s1 = *cast(int[]*)p1;
41 int[] s2 = *cast(int[]*)p2;
42 size_t len = s1.length;
46 for (size_t u = 0; u < len; u++)
48 int result = s1[u] - s2[u];
52 if (s1.length < s2.length)
54 else if (s1.length > s2.length)
59 override size_t tsize()
61 return (int[]).sizeof;
69 override TypeInfo next()
77 int[][] a = [[5,3,8,7], [2,5,3,8,7]];
79 assert(a == [[2,5,3,8,7], [5,3,8,7]]);
81 a = [[5,3,8,7], [5,3,8]];
83 assert(a == [[5,3,8], [5,3,8,7]]);
88 class TypeInfo_Ak : TypeInfo_Ai
90 override string toString() { return "uint[]"; }
92 override int compare(in void* p1, in void* p2)
94 uint[] s1 = *cast(uint[]*)p1;
95 uint[] s2 = *cast(uint[]*)p2;
96 size_t len = s1.length;
100 for (size_t u = 0; u < len; u++)
102 int result = s1[u] - s2[u];
106 if (s1.length < s2.length)
108 else if (s1.length > s2.length)
113 override TypeInfo next()
121 class TypeInfo_Aw : TypeInfo_Ak
123 override string toString() { return "dchar[]"; }
125 override TypeInfo next()
127 return typeid(dchar);