struct field alignment

Emil Madsen sovende at gmail.com
Mon Oct 18 03:20:52 PDT 2010


About the 16byte alignment, of 4floats, its mostlikely for SSE :)

On 18 October 2010 04:16, Denis Koroskin <2korden at gmail.com> wrote:

> On Mon, 18 Oct 2010 06:00:49 +0400, Walter Bright <
> newshound2 at digitalmars.com> wrote:
>
>  http://www.digitalmars.com/d/2.0/attribute.html#align
>>
>> Over time, it has become clear to me that there are only two useful
>> alignments:
>>
>>   align     // set to whatever the C ABI alignment is
>>   align(1)  // pack everything in, no alignment padding
>>
>> I think any other alignments should be deprecated. Note that with
>> align(1), any alignment is achievable simply by adding in byte fields where
>> desired.
>>
>
> On some platforms it is desired to align struct Vec { float[4] data; } on
> 16 bytes. I don't recall why now, but I know for sure we do that for all
> platforms (other than PC maybe). I guess that has something to do with
> vector operations.
>
> Bikeshed note: how about align(C) to be consistent with both align(1) and
> extern(C)?
>



-- 
// Yours sincerely
// Emil 'Skeen' Madsen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20101018/16373e0a/attachment.html>


More information about the Digitalmars-d mailing list