Work around conservative optimization

kinke noone at nowhere.com
Sun Jun 3 11:54:29 UTC 2018


On Saturday, 2 June 2018 at 18:32:37 UTC, Johan Engelen wrote:
> ```
> void store32_le_optim(ref ubyte[4] dest, uint val)
> {
>     import core.stdc.string;
>     ubyte[4] temp;
>     temp[0]=cast(ubyte)val;
>     temp[1]=cast(ubyte)(val>>8);
>     temp[2]=cast(ubyte)(val>>16);
>     temp[3]=cast(ubyte)(val>>24);
>     memcpy(&dest, &temp, temp.sizeof);
> }
> ```

[For endian-ness conversion of integers, we have 
ldc.intrinsics.llvm_bswap().]


More information about the digitalmars-d-ldc mailing list