Content deleted Content added
Johnmorgan (talk | contribs) Added detail about Data Structure Padding and revised Problems. |
Johnmorgan (talk | contribs) No edit summary |
||
Line 1:
{{context}}
'''Data
Although many computer languages and computer language implementations handle data alignment automatically, others allow at least partial control of data structure padding. In certain circumstances this might allow a program to use less memory for storing data in return for slower access to it. This compromise may be considered a form of [[space-time tradeoff]]. == Definitions ==
A memory address ''a'', is said to be ''n-byte aligned'' when ''n'' is a power of two and ''a'' is a multiple of ''n'' [[byte|bytes]]. In this context a byte is the smallest unit of memory access, i.e. each memory address specifies a different byte. An ''n''-byte aligned address would have ''log<sub>2</sub> n'' least-significant zeros when expressed in [[Binary numeral system|binary]].
A memory access is said to be ''aligned'' when the datum being accessed is ''n'' bytes long and the datum address is ''n''-byte aligned. When a memory access is not aligned, it is said to be ''misaligned''. Note that by definition byte memory accesses are always aligned.
|