The
notion that a
computer memory location has an
address which is a
multiple of some
value.
This notion is used in a variety of ways:
- the "aligned" form is used to refer to a location which has a particular "alignment".
- "n-byte alignment" refers to the notion of placing memory locations at addresses which are multiples of n.
For example, a "4-byte aligned" location has an address which is a multiple of 4.
- data type alignment" refers to the notion of placing memory locations at addresses which are multiples of the size of data type entities.
Some examples are probably in order:
- "4-byte aligned" refers to a memory location which has an address which is a multiple of 4.
- "word aligned" refers to a memory location which has an address which is a multiple of the size of a "word" (note that the size of a "word" varies from architecture to architecture).
- "integer aligned" which refers to a memory location which has an address which is a multiple of the size of an "integer" (again, the size of an "integer" varies from architecture to architecture).
Data types which are often used in "
data type aligned" or "
data type alignment" are (in alphabetical order):
- byte
- double precision - a floating point entity which is the size of a C programming language "double" (usually but not always 8 bytes long)
- double word - double the size of a "word"
- full word - synonym for "word" when clarity is important
- half word - half the size of a "word"
- int - refers to the C "int" data type
- integer - a synonym for "int"
- long - refer's to the C "long" data type
- page - refers to a virtual memory page (usually 4K these days but other powers of two like 512, 1024, 2048 and 8192 are not unheard of)
- quad - a synonym for "quad precision"
- quad precision - a floating point entity which is the size of a C "long double" (usually but not always 16 bytes long)
- short - refers to the C "short" datatype
- single precision - a floating point entity which is the size of a C "float" (usually but not always 4 bytes long)
- word - the 'natural' word size on the machine (typically the size of an "int")
The above list uses
C data types to avoid having to define terms like "int" in architecture-
neutral ways.
This writeup makes a critical and subtle assumption - that we're dealing with machine architectures that have byte-addressable memory which means that each byte has a unique address.
Some machines are word-addressable which means that each word has a unique address and the way to get at a byte is to fetch the word and then use a combination of shift and mask operations to extract the byte from the word (word-addressable machines are pretty rare these days).
If I recall correctly, the old Cray vector-style supercomputers were word-addressable and not byte-addressable.