From 9c791a4e8475529ff9385d1bdfaf8fa536225719 Mon Sep 17 00:00:00 2001 From: JinShil Date: Mon, 1 Apr 2019 06:52:02 +0900 Subject: [PATCH] Remove _d_arraycast --- mak/DOCS | 1 - mak/SRCS | 1 - src/rt/arraycast.d | 52 ---------------------------------------------- 3 files changed, 54 deletions(-) delete mode 100644 src/rt/arraycast.d diff --git a/mak/DOCS b/mak/DOCS index 96121956cd..0a93f641f9 100644 --- a/mak/DOCS +++ b/mak/DOCS @@ -79,7 +79,6 @@ DOCS=\ $(DOCDIR)\rt_adi.html \ $(DOCDIR)\rt_alloca.html \ $(DOCDIR)\rt_arrayassign.html \ - $(DOCDIR)\rt_arraycast.html \ $(DOCDIR)\rt_arraycat.html \ \ $(DOCDIR)\rt_backtrace_dwarf.html \ diff --git a/mak/SRCS b/mak/SRCS index 0904b9029e..2aded39208 100644 --- a/mak/SRCS +++ b/mak/SRCS @@ -407,7 +407,6 @@ SRCS=\ src\rt\adi.d \ src\rt\alloca.d \ src\rt\arrayassign.d \ - src\rt\arraycast.d \ src\rt\arraycat.d \ src\rt\cast_.d \ src\rt\cmath2.d \ diff --git a/src/rt/arraycast.d b/src/rt/arraycast.d deleted file mode 100644 index cba5de0ba4..0000000000 --- a/src/rt/arraycast.d +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Implementation of array cast support routines. - * - * Copyright: Copyright Digital Mars 2004 - 2016. - * License: Distributed under the - * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). - * Authors: Walter Bright, Sean Kelly - * Source: $(DRUNTIMESRC rt/_arraycast.d) - */ - -module rt.arraycast; - -/****************************************** - * Runtime helper to convert dynamic array of one - * type to dynamic array of another. - * Adjusts the length of the array. - * Throws an error if new length is not aligned. - */ - -extern (C) - -@trusted nothrow -void[] _d_arraycast(size_t tsize, size_t fsize, void[] a) -{ - auto length = a.length; - - auto nbytes = length * fsize; - if (nbytes % tsize != 0) - { - throw new Error("array cast misalignment"); - } - length = nbytes / tsize; - *cast(size_t *)&a = length; // jam new length - return a; -} - -unittest -{ - byte[int.sizeof * 3] b; - int[] i; - short[] s; - - i = cast(int[])b; - assert(i.length == 3); - - s = cast(short[])b; - assert(s.length == 6); - - s = cast(short[])i; - assert(s.length == 6); -} -