[ scummvm-Patches-754151 ] ALL: READ...() vs READ...UNALIGNED()

SourceForge.net noreply at sourceforge.net
Fri Jun 13 20:39:25 CEST 2003


Patches item #754151, was opened at 2003-06-13 20:39
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=754151&group_id=37116

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Torbjörn Andersson (eriktorbjorn)
Assigned to: Nobody/Anonymous (nobody)
Summary: ALL: READ...() vs READ...UNALIGNED()

Initial Comment:
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,
when necessary.

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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=754151&group_id=37116




More information about the Scummvm-tracker mailing list