ALL: READ...() vs READ...UNALIGNED()
|Reported by:||eriktorbjorn||Owned by:||fingolfin|
WooShell was having problems with unaligned reads in
the NUT renderer when playing The Dig on a Sparc.
Looking at scummsys.h, I noticed that in the
little-endian case, we automatically define the READ
primitives to be alignment-safe, if
SCUMM_NEED_ALIGNMENT is defined. The _UNALIGNED read
primitives are just aliases for the normal read
primitives, since they all work on big-endian values.
However, in the big-endian case READ_BE_...() are never
alignment-safe, so it's the caller's responsibility to
use the READ_BE_..._UNALIGNED() primitives instead,
Is there any particular reason we do it this way?
Couldn't we just get rid of the _UNALIGNED primitives
completely? I realize that the alignment-safe
primitives will be a bit slower of course, but I
vaguely remember experimenting with this sort of thing
on an assignment at school once. The speedup wasn't
that great, really, and from what I recall that code
did quite a lot of reading and writing...
This patch changes the big-endian case to be more like
the little-endian case, but doesn't touch any other
files since I wanted some feedback on this part first.
Ticket imported from: #754151. Ticket imported from: patches/352.