alignment on stack-allocated arrays/structs

Don nospam at nospam.com
Wed Nov 18 01:05:30 PST 2009


> OpenCL requires all types to be naturally aligned.
> /*
>  * Vector types
>  *
>  *  Note:   OpenCL requires that all types be naturally aligned.
>  *          This means that vector types must be naturally aligned.
>  *          For example, a vector of four floats must be aligned to
>  *          a 16 byte boundary (calculated as 4 * the natural 4-byte
>  *          alignment of the float).  The alignment qualifiers here
>  *          will only function properly if your compiler supports them
>  *          and if you don't actively work to defeat them.  For example,
>  *          in order for a cl_float4 to be 16 byte aligned in a struct,
>  *          the start of the struct must itself be 16-byte aligned.

http://d.puremagic.com/issues/show_bug.cgi?id=2278



More information about the Digitalmars-d mailing list