Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit e90650d

Browse files
committed
Replace mixin with class and reduce number of files
1 parent 314598c commit e90650d

File tree

14 files changed

+138
-409
lines changed

14 files changed

+138
-409
lines changed

mak/DOCS

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,7 @@ DOCS=\
114114
$(DOCDIR)\rt_trace.html \
115115
$(DOCDIR)\rt_tracegc.html \
116116
\
117-
$(DOCDIR)\rt_typeinfo_ti_Acdouble.html \
118-
$(DOCDIR)\rt_typeinfo_ti_Acfloat.html \
119-
$(DOCDIR)\rt_typeinfo_ti_Acreal.html \
120-
$(DOCDIR)\rt_typeinfo_ti_Adouble.html \
121-
$(DOCDIR)\rt_typeinfo_ti_Afloat.html \
122-
$(DOCDIR)\rt_typeinfo_ti_Ag.html \
123-
$(DOCDIR)\rt_typeinfo_ti_Aint.html \
124-
$(DOCDIR)\rt_typeinfo_ti_Along.html \
125-
$(DOCDIR)\rt_typeinfo_ti_Areal.html \
126-
$(DOCDIR)\rt_typeinfo_ti_Ashort.html \
117+
$(DOCDIR)\rt_typeinfo_ti_A.html \
127118
$(DOCDIR)\rt_typeinfo_ti_byte.html \
128119
$(DOCDIR)\rt_typeinfo_ti_C.html \
129120
$(DOCDIR)\rt_typeinfo_ti_cdouble.html \

mak/SRCS

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -452,16 +452,7 @@ SRCS=\
452452
src\rt\util\container\hashtab.d \
453453
src\rt\util\container\treap.d \
454454
\
455-
src\rt\typeinfo\ti_Acdouble.d \
456-
src\rt\typeinfo\ti_Acfloat.d \
457-
src\rt\typeinfo\ti_Acreal.d \
458-
src\rt\typeinfo\ti_Adouble.d \
459-
src\rt\typeinfo\ti_Afloat.d \
460-
src\rt\typeinfo\ti_Ag.d \
461-
src\rt\typeinfo\ti_Aint.d \
462-
src\rt\typeinfo\ti_Along.d \
463-
src\rt\typeinfo\ti_Areal.d \
464-
src\rt\typeinfo\ti_Ashort.d \
455+
src\rt\typeinfo\ti_A.d \
465456
src\rt\typeinfo\ti_byte.d \
466457
src\rt\typeinfo\ti_C.d \
467458
src\rt\typeinfo\ti_cdouble.d \

src/rt/typeinfo/ti_A.d

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
/**
2+
* TypeInfo support code.
3+
*
4+
* Copyright: Copyright Digital Mars 2004 - 2009.
5+
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6+
* Authors: Walter Bright
7+
*/
8+
9+
/* Copyright Digital Mars 2004 - 2009.
10+
* Distributed under the Boost Software License, Version 1.0.
11+
* (See accompanying file LICENSE or copy at
12+
* http://www.boost.org/LICENSE_1_0.txt)
13+
*/
14+
module rt.typeinfo.ti_A;
15+
16+
private import rt.util.typeinfo;
17+
18+
// cdouble[]
19+
class TypeInfo_Ar : Impl_TypeInfo_A!cdouble {}
20+
21+
// cfloat[]
22+
class TypeInfo_Aq : Impl_TypeInfo_A!cfloat {}
23+
24+
// creal[]
25+
class TypeInfo_Ac : Impl_TypeInfo_A!creal {}
26+
27+
// double[]
28+
class TypeInfo_Ad : Impl_TypeInfo_A!double {}
29+
30+
// idouble[]
31+
class TypeInfo_Ap : Impl_TypeInfo_A!idouble {}
32+
33+
// float[]
34+
class TypeInfo_Af : Impl_TypeInfo_A!float {}
35+
36+
// ifloat[]
37+
class TypeInfo_Ao : Impl_TypeInfo_A!ifloat {}
38+
39+
// byte[]
40+
class TypeInfo_Ag : Impl_TypeInfo_A!byte {}
41+
42+
// ubyte[]
43+
class TypeInfo_Ah : Impl_TypeInfo_A!ubyte {};
44+
45+
// void[]
46+
class TypeInfo_Av : Impl_TypeInfo_A!void {}
47+
48+
// bool[]
49+
class TypeInfo_Ab : Impl_TypeInfo_A!bool {}
50+
51+
// char[]
52+
class TypeInfo_Aa : Impl_TypeInfo_A!char {}
53+
54+
// string
55+
class TypeInfo_Aya : Impl_TypeInfo_A!(immutable(char)) {}
56+
57+
// const(char)[]
58+
class TypeInfo_Axa : Impl_TypeInfo_A!(const(char)) {}
59+
60+
61+
extern (C) void[] _adSort(void[] a, TypeInfo ti);
62+
63+
// int[]
64+
class TypeInfo_Ai : Impl_TypeInfo_A!int {}
65+
66+
unittest
67+
{
68+
int[][] a = [[5,3,8,7], [2,5,3,8,7]];
69+
_adSort(*cast(void[]*)&a, typeid(a[0]));
70+
assert(a == [[2,5,3,8,7], [5,3,8,7]]);
71+
72+
a = [[5,3,8,7], [5,3,8]];
73+
_adSort(*cast(void[]*)&a, typeid(a[0]));
74+
assert(a == [[5,3,8], [5,3,8,7]]);
75+
}
76+
77+
unittest
78+
{
79+
// Issue 13073: original code uses int subtraction which is susceptible to
80+
// integer overflow, causing the following case to fail.
81+
int[] a = [int.max, int.max];
82+
int[] b = [int.min, int.min];
83+
assert(a > b);
84+
assert(b < a);
85+
}
86+
87+
// uint[]
88+
class TypeInfo_Ak : Impl_TypeInfo_A!uint {}
89+
90+
unittest
91+
{
92+
// Original test case from issue 13073
93+
uint x = 0x22_DF_FF_FF;
94+
uint y = 0xA2_DF_FF_FF;
95+
assert(!(x < y && y < x));
96+
uint[] a = [x];
97+
uint[] b = [y];
98+
assert(!(a < b && b < a)); // Original failing case
99+
uint[1] a1 = [x];
100+
uint[1] b1 = [y];
101+
assert(!(a1 < b1 && b1 < a1)); // Original failing case
102+
}
103+
104+
// dchar[]
105+
class TypeInfo_Aw : Impl_TypeInfo_A!dchar {}
106+
107+
108+
// long[]
109+
class TypeInfo_Al : Impl_TypeInfo_A!long {}
110+
111+
// ulong[]
112+
class TypeInfo_Am : Impl_TypeInfo_A!ulong {}
113+
114+
// real[]
115+
class TypeInfo_Ae : Impl_TypeInfo_A!real {}
116+
117+
// ireal[]
118+
class TypeInfo_Aj : Impl_TypeInfo_A!ireal {}
119+
120+
// short[]
121+
class TypeInfo_As : Impl_TypeInfo_A!short {}
122+
123+
// ushort[]
124+
class TypeInfo_At : Impl_TypeInfo_A!ushort {}
125+
126+
// wchar[]
127+
class TypeInfo_Au : Impl_TypeInfo_A!wchar {}

src/rt/typeinfo/ti_Acdouble.d

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/rt/typeinfo/ti_Acfloat.d

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/rt/typeinfo/ti_Acreal.d

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/rt/typeinfo/ti_Adouble.d

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/rt/typeinfo/ti_Afloat.d

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/rt/typeinfo/ti_Ag.d

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)