#if defined(U32_ALIGNMENT_REQUIRED) && defined(__GNUC__) && (defined(__x86_64__) || defined(__i386))
/* Generate SIGBUS on unaligned access even on x86:
Set AC in EFLAGS. See http://orchistro.tistory.com/206
Also see https://sourceforge.net/p/predef/wiki/Architectures/
for possible other compilers. Here only GNU C: gcc, clang, icc.
MSVC would be nice also. */
#ifdef __x86_64__
__asm__("pushf\n"
"orl $0x40000, (%rsp)\n"
"popf");
#else
__asm__("pushf\n"
"orl $0x40000, (%esp)\n"
"popf");
#endif
#endif
This way you won't get the SPARC/MIPS surprises debian maintainers are struggling with. If it doesn't align, copy it temp. It's still faster.
Actually you can enforce that on Intel too. I do that for some hash functions in debugging mode, to avoid valgrind slowdown.
e.g. https://github.com/perl11/cperl/blob/master/cpan/Digest-MD5/...
This way you won't get the SPARC/MIPS surprises debian maintainers are struggling with. If it doesn't align, copy it temp. It's still faster.