Allocating byte aligned array

timvol timvol at unknownmailaddress.com
Wed Sep 27 21:48:35 UTC 2017


On Wednesday, 27 September 2017 at 21:44:48 UTC, Ali Çehreli 
wrote:
> On 09/27/2017 02:39 PM, timvol wrote:
>> [...]
>
> void main() {
>     auto mem = new ubyte[1024+15];
>     auto ptr = cast(ubyte*)(cast(ulong)(mem.ptr + 15) & 
> ~0x0FUL);
>     auto arr = ptr[0..1024];
> }
>
> Ali

Works perfect. Thank you!


More information about the Digitalmars-d-learn mailing list