Debian Codegraph @

libphobos/libdruntime/rt/arraycat.d

raw
1 /**
2 * Implementation of array copy support routines.
3 *
4 * Copyright: Copyright Digital Mars 2004 - 2016.
5 * License: Distributed under the
6 * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
7 * Authors: Walter Bright, Sean Kelly
8 * Source: $(DRUNTIMESRC rt/_arraycat.d)
9 */
10
11 module rt.arraycat;
12
13 // debug = PRINTF;
14
15 import core.internal.util.array;
16 import core.stdc.string : memcpy;
17
18 debug(PRINTF) import core.stdc.stdio : printf;
19
20 extern (C) @trusted nothrow:
21
22 void[] _d_arraycopy(size_t size, void[] from, void[] to)
23 {
24 debug(PRINTF) printf("f = %p,%zd, t = %p,%zd, size = %zd\n",
25 from.ptr, from.length, to.ptr, to.length, size);
26
27 enforceRawArraysConformable("copy", size, from, to);
28 memcpy(to.ptr, from.ptr, to.length * size);
29 return to;
30 }