2 module rt.typeinfo.ti_Ashort;
4 private import stdc.string;
8 class TypeInfo_As : TypeInfo
10 override string toString() { return "short[]"; }
12 override hash_t getHash(in void* p)
13 { short[] s = *cast(short[]*)p;
14 size_t len = s.length;
27 hash += *cast(ushort *)str;
32 hash += *cast(uint *)str;
42 override equals_t equals(in void* p1, in void* p2)
44 short[] s1 = *cast(short[]*)p1;
45 short[] s2 = *cast(short[]*)p2;
47 return s1.length == s2.length &&
48 memcmp(cast(void *)s1, cast(void *)s2, s1.length * short.sizeof) == 0;
51 override int compare(in void* p1, in void* p2)
53 short[] s1 = *cast(short[]*)p1;
54 short[] s2 = *cast(short[]*)p2;
55 size_t len = s1.length;
59 for (size_t u = 0; u < len; u++)
61 int result = s1[u] - s2[u];
65 if (s1.length < s2.length)
67 else if (s1.length > s2.length)
72 override size_t tsize()
74 return (short[]).sizeof;
82 override TypeInfo next()
91 class TypeInfo_At : TypeInfo_As
93 override string toString() { return "ushort[]"; }
95 override int compare(in void* p1, in void* p2)
97 ushort[] s1 = *cast(ushort[]*)p1;
98 ushort[] s2 = *cast(ushort[]*)p2;
99 size_t len = s1.length;
103 for (size_t u = 0; u < len; u++)
105 int result = s1[u] - s2[u];
109 if (s1.length < s2.length)
111 else if (s1.length > s2.length)
116 override TypeInfo next()
118 return typeid(ushort);
124 class TypeInfo_Au : TypeInfo_At
126 override string toString() { return "wchar[]"; }
128 override TypeInfo next()
130 return typeid(wchar);