overlapping copy semantics question

kinke noone at nowhere.com
Mon May 20 18:14:50 UTC 2024


I think the problem here is that you don't get the expected 
optimization to a memcpy (with -O3) when using the `@restrict` 
UDA, with the variant taking a D slice. So no correctness issue.

This boils down to the expected memcpy, apparently needing 
unpacking of D slices:
```
void cpr2(size_t srcLength, ubyte* src, @restrict ubyte* dst)
{
     foreach (i; 0 .. srcLength)
         dst[i] = src[i];
}
```



More information about the digitalmars-d-ldc mailing list