www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/31/13:17:40

Date: Thu, 31 Jul 1997 10:15:00 -0700 (PDT)
Message-Id: <199707311715.KAA18658@adit.ap.net>
Mime-Version: 1.0
To: gangster AT lino DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: How to Align Data
Cc: djgpp AT delorie DOT com

You wrote:
>Maybe I didn't ask the right question :-)
>
>I Wanted to know if I can find documentation on WHY it is important to
>align data...
On a 386-class machine, the only reason is for performance. The 386 has a
32-bit bus. If you try to access, say, a 32-bit operand, and it isn't
aligned on a 32-bit boundary, it will require two bus cycles instead of one
to do the access. The on-chip cache also works better with certain
alignments, but I don't know all the details. Looking at GCC's assembly
output may give you some ideas about what kind of alignments are a good idea.
On some RISC processors, alignment is required, and not having it will cause
an exception.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019