Article View: comp.arch
Article #13677Byte .vs. Word Alignment
From: Jon Boede
Date: Wed, 15 Apr 1987 13:35
Date: Wed, 15 Apr 1987 13:35
33 lines
1761 bytes
1761 bytes
This is probably the most trivial of questions, but I've always wondered if
wordwise alignment affected efficiency on the 68000.
For example, assuming that a structure like:
struct {
int an_int;
char a_char;
} a_struct;
starts on a word boundry, would a structure placing the /char/ first and the
/int/ therefore a 1/4 word off be less, can we say, "efficient" in terms of
the manipulation needed to get to /an_int/?? Or doesn't the C compiler always
start structures on words boundries, making alignment consideration by the
programmer meaningless?
struct {
char a_char;
int an_int;
} a_struct; /* is this less "efficient"? */
Also, whilst I'm on the subject, how much extra effort is required of the
68000 to get to specific bits than to, say, an int? I often use structures
of bit flags to save space in files. I can easily compute the space savings,
but an accurate guess as to the time savings is a little more elusive.
Thanks!
--
Jon Boede ...!{ihnp4,akgua,gatech}!petro!jrb
512/599-1847 2555 N.E. Loop 410, #1403, 78217
"People who are incapable of making decisions are
the ones who hit those barrels at freeway exits."
Technical Details
Message-ID:
<244@petro.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!im4u!swrinde!petro!jrbShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!im4u!swrinde!petro!jrb From: jrb@petro.UUCP (Jon Boede) Newsgroups: comp.arch,comp.lang.c Subject: Byte .vs. Word Alignment Message-ID: <244@petro.UUCP> Date: Wed, 15-Apr-87 08:35:44 EST Article-I.D.: petro.244 Posted: Wed Apr 15 08:35:44 1987 Date-Received: Sun, 19-Apr-87 05:15:08 EST Sender: news@petro.UUCP Organization: G.M. Andreen & Associates, Inc. San Antonio, Texas Lines: 32 Keywords: C, 680X0, Alignment Environment: Tandy 6000, XENIX 3.01.02, MC68000