CTFE Status 2

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 12 03:08:27 PDT 2017


On Wednesday, 12 July 2017 at 09:46:39 UTC, Kagamin wrote:
> On Wednesday, 12 July 2017 at 07:58:30 UTC, Stefan Koch wrote:
>> Whereas A struct is always stored __packed__ and aligned to 4 
>> byte boundaries
>>
>> struct S // size: 20
>> {
>>   ubyte m1; // offset: 0
>>   ulong m2; // offset: 4
>>   ubyte m3; // offset: 12
>>   ubyte m4; // offset: 16
>> }
>
> Do you plan to keep it like that? This won't work on non-x86 
> architectures that don't allow unaligned memory access.
For the time being, yes I plan to keep it.
It is 4 byte aligned which is plenty of alignment.

For architectures which do not allow unaligned access we would 
split the ulong into hi and lo parts.
64bit arithmetic can generally be assumed to take a slower path 
in newCTFE.




More information about the Digitalmars-d mailing list