[Bug 293] Utilize assert (ptr == (ptr & -align)) to assume alignment

gdc-bugzilla at gdcproject.org gdc-bugzilla at gdcproject.org
Thu Jun 21 15:39:12 UTC 2018


https://bugzilla.gdcproject.org/show_bug.cgi?id=293

--- Comment #1 from ARaspiK <araspik at protonmail.com> ---
General pseudocode:
void* dst = ...;

Possible D code for alignment assumption:

assert ((dst & -0x10) == dst);
assert ((dst & 0xf) == 0);

Possible C code for alignment assumption:

dst = __builtin_assume_aligned(dst, 16);

Here is a StackOverflow (capitalization?) question on it:
https://stackoverflow.com/q/9608171/9781227

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the D.gnu mailing list