2.2: Data Storage Sizes
- Page ID
- 19863
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)
The x86-64 architecture supports a specific set of data storage size elements, all based on powers of two. The supported storage sizes are as follows:
Storage | Size (bits) | Size (bytes) |
---|---|---|
Byte | 8-bits | 1 byte |
Word | 16-bits | 2 bytes |
Double-word | 32-bits | 4 bytes |
Quadword | 64-bits | 8 bytes |
Double quadword | 128-bits | 16 bytes |
Lists or arrays (sets of memory) can be reserved in any of these types.
These storage sizes have a direct correlation to variable declarations in high-level languages (e.g., C, C++, Java, etc.).
C/C++ Declaration | Storage | Size (bits) | Size (bytes) |
---|---|---|---|
CHAR | Byte | 8-bits | 1 byte |
short | Word | 16-bits | 2 bytes |
int | Double-word | 32-bits | 4 bytes |
unsigned int | Double-word | 32-bits | 4 bytes |
long(Note, the 'long' type declaration is compiler dependent. Type shown is for gcc and g++ compilers.) | Quadword | 64-bits | 8 bytes |
long long | Quadword | 64-bits | 8 bytes |
char * | Quadword | 64-bits | 8 bytes |
int * | Quadword | 64-bits | 8 bytes |
float | Double-word | 32-bits | 4 bytes |
double | Quadword | 64-bits | 8 bytes |
The asterisk indicates an address variable. For example, int * means the address of an integer. Other high-level languages typically have similar mappings.