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

Commit

Permalink
Replace mixin with class and reduce number of files
Browse files Browse the repository at this point in the history
  • Loading branch information
edi33416 committed Mar 13, 2019
1 parent 314598c commit f837f14
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 425 deletions.
11 changes: 1 addition & 10 deletions mak/DOCS
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,7 @@ DOCS=\
$(DOCDIR)\rt_trace.html \
$(DOCDIR)\rt_tracegc.html \
\
$(DOCDIR)\rt_typeinfo_ti_Acdouble.html \
$(DOCDIR)\rt_typeinfo_ti_Acfloat.html \
$(DOCDIR)\rt_typeinfo_ti_Acreal.html \
$(DOCDIR)\rt_typeinfo_ti_Adouble.html \
$(DOCDIR)\rt_typeinfo_ti_Afloat.html \
$(DOCDIR)\rt_typeinfo_ti_Ag.html \
$(DOCDIR)\rt_typeinfo_ti_Aint.html \
$(DOCDIR)\rt_typeinfo_ti_Along.html \
$(DOCDIR)\rt_typeinfo_ti_Areal.html \
$(DOCDIR)\rt_typeinfo_ti_Ashort.html \
$(DOCDIR)\rt_typeinfo_ti_A.html \
$(DOCDIR)\rt_typeinfo_ti_byte.html \
$(DOCDIR)\rt_typeinfo_ti_C.html \
$(DOCDIR)\rt_typeinfo_ti_cdouble.html \
Expand Down
11 changes: 1 addition & 10 deletions mak/SRCS
Original file line number Diff line number Diff line change
Expand Up @@ -452,16 +452,7 @@ SRCS=\
src\rt\util\container\hashtab.d \
src\rt\util\container\treap.d \
\
src\rt\typeinfo\ti_Acdouble.d \
src\rt\typeinfo\ti_Acfloat.d \
src\rt\typeinfo\ti_Acreal.d \
src\rt\typeinfo\ti_Adouble.d \
src\rt\typeinfo\ti_Afloat.d \
src\rt\typeinfo\ti_Ag.d \
src\rt\typeinfo\ti_Aint.d \
src\rt\typeinfo\ti_Along.d \
src\rt\typeinfo\ti_Areal.d \
src\rt\typeinfo\ti_Ashort.d \
src\rt\typeinfo\ti_A.d \
src\rt\typeinfo\ti_byte.d \
src\rt\typeinfo\ti_C.d \
src\rt\typeinfo\ti_cdouble.d \
Expand Down
127 changes: 127 additions & 0 deletions src/rt/typeinfo/ti_A.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/**
* TypeInfo support code.
*
* Copyright: Copyright Digital Mars 2004 - 2009.
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Walter Bright
*/

/* Copyright Digital Mars 2004 - 2019.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
module rt.typeinfo.ti_A;

private import rt.util.typeinfo;

// cdouble[]
class TypeInfo_Ar : Impl_TypeInfo_A!cdouble {}

// cfloat[]
class TypeInfo_Aq : Impl_TypeInfo_A!cfloat {}

// creal[]
class TypeInfo_Ac : Impl_TypeInfo_A!creal {}

// double[]
class TypeInfo_Ad : Impl_TypeInfo_A!double {}

// idouble[]
class TypeInfo_Ap : Impl_TypeInfo_A!idouble {}

// float[]
class TypeInfo_Af : Impl_TypeInfo_A!float {}

// ifloat[]
class TypeInfo_Ao : Impl_TypeInfo_A!ifloat {}

// byte[]
class TypeInfo_Ag : Impl_TypeInfo_A!byte {}

// ubyte[]
class TypeInfo_Ah : Impl_TypeInfo_A!ubyte {};

// void[]
class TypeInfo_Av : Impl_TypeInfo_A!void {}

// bool[]
class TypeInfo_Ab : Impl_TypeInfo_A!bool {}

// char[]
class TypeInfo_Aa : Impl_TypeInfo_A!char {}

// string
class TypeInfo_Aya : Impl_TypeInfo_A!(immutable(char)) {}

// const(char)[]
class TypeInfo_Axa : Impl_TypeInfo_A!(const(char)) {}


extern (C) void[] _adSort(void[] a, TypeInfo ti);

// int[]
class TypeInfo_Ai : Impl_TypeInfo_A!int {}

unittest
{
int[][] a = [[5,3,8,7], [2,5,3,8,7]];
_adSort(*cast(void[]*)&a, typeid(a[0]));
assert(a == [[2,5,3,8,7], [5,3,8,7]]);

a = [[5,3,8,7], [5,3,8]];
_adSort(*cast(void[]*)&a, typeid(a[0]));
assert(a == [[5,3,8], [5,3,8,7]]);
}

unittest
{
// Issue 13073: original code uses int subtraction which is susceptible to
// integer overflow, causing the following case to fail.
int[] a = [int.max, int.max];
int[] b = [int.min, int.min];
assert(a > b);
assert(b < a);
}

// uint[]
class TypeInfo_Ak : Impl_TypeInfo_A!uint {}

unittest
{
// Original test case from issue 13073
uint x = 0x22_DF_FF_FF;
uint y = 0xA2_DF_FF_FF;
assert(!(x < y && y < x));
uint[] a = [x];
uint[] b = [y];
assert(!(a < b && b < a)); // Original failing case
uint[1] a1 = [x];
uint[1] b1 = [y];
assert(!(a1 < b1 && b1 < a1)); // Original failing case
}

// dchar[]
class TypeInfo_Aw : Impl_TypeInfo_A!dchar {}


// long[]
class TypeInfo_Al : Impl_TypeInfo_A!long {}

// ulong[]
class TypeInfo_Am : Impl_TypeInfo_A!ulong {}

// real[]
class TypeInfo_Ae : Impl_TypeInfo_A!real {}

// ireal[]
class TypeInfo_Aj : Impl_TypeInfo_A!ireal {}

// short[]
class TypeInfo_As : Impl_TypeInfo_A!short {}

// ushort[]
class TypeInfo_At : Impl_TypeInfo_A!ushort {}

// wchar[]
class TypeInfo_Au : Impl_TypeInfo_A!wchar {}
23 changes: 0 additions & 23 deletions src/rt/typeinfo/ti_Acdouble.d

This file was deleted.

23 changes: 0 additions & 23 deletions src/rt/typeinfo/ti_Acfloat.d

This file was deleted.

23 changes: 0 additions & 23 deletions src/rt/typeinfo/ti_Acreal.d

This file was deleted.

30 changes: 0 additions & 30 deletions src/rt/typeinfo/ti_Adouble.d

This file was deleted.

30 changes: 0 additions & 30 deletions src/rt/typeinfo/ti_Afloat.d

This file was deleted.

67 changes: 0 additions & 67 deletions src/rt/typeinfo/ti_Ag.d

This file was deleted.

Loading

0 comments on commit f837f14

Please sign in to comment.