SCUMM_NEED_ALIGNMENT detection bogus
|Reported by:||SF/mellum||Owned by:||fingolfin|
SCUMM_NEED_ALIGNMENT tries to detect whether unaligned accesses "work". Unfortunately, this is bogus; many systems, like Alpha, don't support unaligned accesses, but catch them with a trap, fix them in kernel space and continue. Therefore, it will appear they work; only they slow down the program by a factor of 100. The only reasonable method is to hardcode architectures where it is known that unaligned accesses are OK and fast. Anyway, I doubt it is of much use for code like this:
#if defined(SCUMM_NEED_ALIGNMENT) memcpy(dst, src, 8); #else ((uint32 *)dst) = ((const uint32 *)src); ((uint32 *)dst) = ((const uint32 *)src); #endif
If gcc doesn't generate optimal code for memcpy(dst, src, 8) for your platform, you should rather file a bug report against gcc than kludge around it.
Ticket imported from: #791741. Ticket imported from: bugs/1175.