On 1/6/2012 11:53 AM, Manu wrote:
... this sounds bad. Shall I start another thread? ;)
So you're saying it's impossible to align a stack based buffer to, say, 128
bytes... ?

No, it's not impossible. Here's what you can do now:

char[128+127] buf;
char* pbuf = cast(char*)(((size_t)buf.ptr + 127) & ~127);

and now pbuf points to 128 bytes, aligned, on the stack.


Hopefully the work you do to support 16byte alignment on x86 will also support
arbitrary alignment of any buffer...
Will arbitrary alignment be supported on x64?

Aligning to non-powers of 2 will never work. As for other alignments, they only will work if the underlying storage is aligned to that or greater. Otherwise, you'll have to resort to the method outlined above.


What about GCC? Will/does it support arbitrary alignment?

Don't know about gcc.

Reply via email to