Unaligned access

in gh-3309 I forgot to account for alignment of data, on cpus with unaligned access and the function receiving unaligned memory (not sure if that is possible though) it could crash.

To fix it I moved the byteswap functions to a header and check the alignment in ctors.c.
This has the additional advantage that some older gccs (e.g. gcc-4.4) are faster in the swapping loops.