Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions src/object.d
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ alias dstring = immutable(dchar)[];
version (D_ObjectiveC) public import core.attribute : selector;

public import rt.array.comparison : __cmp;
public import rt.array.equality : __equals;
public import rt.array.equality : __ArrayEq, __equals;

// Compare class and interface objects for ordering.
private int __cmp(Obj)(Obj lhs, Obj rhs)
Expand Down Expand Up @@ -4384,19 +4384,6 @@ private void _doPostblit(T)(T[] arr)
auto a = arr.dup; // dup does escape
}

// compiler frontend lowers dynamic array comparison to this
bool __ArrayEq(T1, T2)(T1[] a, T2[] b)
{
if (a.length != b.length)
return false;
foreach (size_t i; 0 .. a.length)
{
if (a[i] != b[i])
return false;
}
return true;
}

// compiler frontend lowers struct array postblitting to this
void __ArrayPostblit(T)(T[] a)
{
Expand Down
15 changes: 14 additions & 1 deletion src/rt/array/equality.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,20 @@
* Source: $(DRUNTIMESRC rt/_array.d)
*/

module rt.array.equality;
module rt.array.equality;

// compiler frontend lowers dynamic array comparison to this
bool __ArrayEq(T1, T2)(T1[] a, T2[] b)
{
if (a.length != b.length)
return false;
foreach (size_t i; 0 .. a.length)
{
if (a[i] != b[i])
return false;
}
return true;
}

// `lhs == rhs` lowers to `__equals(lhs, rhs)` for dynamic arrays
bool __equals(T1, T2)(T1[] lhs, T2[] rhs)
Expand Down