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

Optimize array cast #2234

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 2 additions & 1 deletion src/rt/arraycast.d
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ void[] _d_arraycast(size_t tsize, size_t fsize, void[] a)
auto length = a.length;

auto nbytes = length * fsize;
if (nbytes % tsize != 0)
version (D_NoBoundsChecks) {}
else if (nbytes % tsize != 0)
{
throw new Error("array cast misalignment");
}
Expand Down