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

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
andralex committed Sep 6, 2020
1 parent 48a4570 commit f14c296
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions src/rt/util/typeinfo.d
Original file line number Diff line number Diff line change
Expand Up @@ -596,32 +596,6 @@ static if (__traits(hasMember, TypeInfo, "argTypes"))
t2 == typeid(real));
}

// All pointer types are represented by `TypeInfo_P`.
// Please keep in sync with `TypeInfo_Pointer`.
class TypeInfo_P : TypeInfoGeneric!(void*)
{
const: nothrow: pure: @trusted:

override size_t getHash(scope const void* p)
{
size_t addr = cast(size_t) *cast(const void**)p;
return addr ^ (addr >> 4);
}

override @property uint flags() nothrow pure const { return 1; }
}

unittest
{
with (new TypeInfo_P)
{
int x;
int* p = &x;
assert(getHash(&p) != 0);
assert(flags == 1);
}
}

// Arrays of all integrals.
class TypeInfo_Ab : TypeInfoArrayGeneric!bool {}
class TypeInfo_Ag : TypeInfoArrayGeneric!byte {}
Expand All @@ -642,7 +616,7 @@ class TypeInfo_Aw : TypeInfoArrayGeneric!dchar {}
class TypeInfo_Al : TypeInfoArrayGeneric!long {}
class TypeInfo_Am : TypeInfoArrayGeneric!ulong {}

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

unittest
{
Expand All @@ -658,7 +632,7 @@ unittest

unittest
{
// Issue 13073: original code uses int subtraction which is susceptible to
// https://issues.dlang.org/show_bug.cgi?id=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];
Expand Down

0 comments on commit f14c296

Please sign in to comment.