Computer architecture
Word size
Also called: 8-bit · 32-bit · 64-bit · word · data width
Definition
A processor's word size is the number of bits it naturally handles in one operation: its register width and usually its main data path.
Picture it
An 8-bit microcontroller adds two 32-bit numbers in four steps; a 32-bit one does it in one. Word size also limits the natural range of integers and, often, how much memory can be addressed directly.
The maths
unsigned range = 0 to 2^n − 1 signed range = −2^(n−1) to 2^(n−1) − 1
| Quantity | Unit | Symbol |
|---|---|---|
| information | bit | bit |
Worked example
What is the largest unsigned value of a 16-bit word, and the signed range of a 32-bit word?
- 2^16 − 1 = 65535
- −2^31 = −2147483648 to 2^31 − 1 = 2147483647
Answer65535; from −2147483648 to 2147483647.
✓ The 2 numbers in this answer are recomputed from scratch by an automated test.
Common misconceptions
- Misconception: A 32-bit processor can still handle 64-bit numbers, just more slowly.
- Misconception: int in C is not always 32 bits; use fixed-width types such as int32_t in firmware.