Replacing C's memcpy with a D implementation

solidstate1991 laszloszeremi at outlook.com
Sun Jun 10 22:21:27 UTC 2018


On Sunday, 10 June 2018 at 12:49:31 UTC, Mike Franklin wrote:
> void memcpyASM()
> {
>     auto s = src.ptr;
>     auto d = dst.ptr;
>     size_t len = length;
>     asm pure nothrow @nogc
>     {
>         mov RSI, s;
>         mov RDI, d;
>         cld;
>         mov RCX, len;
>         rep;
>         movsb;
>     }
> }
Protip: Use SSE or AVX for an even faster copying.


More information about the Digitalmars-d mailing list