| Bits and bytes | ||||||||||
| Physical representation | ||||||||||
| "Bits is bits": 10101100011 | ||||||||||
| bit: single binary digit, value 0 or 1 | ||||||||||
| nybble: 4 bits | ||||||||||
| byte: 8 bits | ||||||||||
| halfword: 16 bits (2 bytes) | ||||||||||
| word: 32 bits (4 bytes); can vary with machine architecture | ||||||||||
| 32-bit architecture in this class | ||||||||||
| doubleword: 64 bits (8 bytes) | ||||||||||
| bit string: any number of consecutive bits (11 bits in example) | ||||||||||
| Logical representation | ||||||||||
| bits + context = information | ||||||||||
| consider bit string with k bits (k = 6) | ||||||||||
| b5 | b4 | b3 | b2 | b1 | b0 | |||||
| 0 | 1 | 1 | 0 | 1 | 0 | |||||
| value: | ||||||||||
| b5 * 25 | b4 * 24 | b3 * 23 | b2 * 22 | b1 * 21 | b0 * 20 | |||||
| 0 * 32 | 1 * 16 | 1 * 8 | 0 * 4 | 1 * 2 | 0 * 1 | |||||
| 0 | 16 | 8 | 0 | 2 | 0 | |||||
| 16 | + 8 | + 2 | = 26ten | |||||||
| unsigned binary representation | ||||||||||
| least significant bit (lsb): | b0 | |||||||||
| most significant bit (msb): | bk-1 | |||||||||