Data Representation
Overview
Every value a computer manipulates — an integer, a character, a color, an instruction — is ultimately a fixed-width string of bits. This section covers how those bits encode meaning: binary/hexadecimal notation, signed integers (two's complement), and the bitwise techniques programmers use to pack, test, and transform data directly at the bit level. It deliberately skips grade-school binary/decimal conversion — the focus is on the representations and tricks that matter for real systems work.
In this section
- Basics — binary/hex notation and bitwise operators as building blocks.
- Integers & Two's Complement — fixed-width signed integers, overflow, and signed/unsigned comparison pitfalls.
- Floating Point — IEEE 754 bit layout, rounding error, and special values.
- Character Encoding — ASCII, Unicode code points, and UTF-8.
- Bit Manipulation Techniques — practical bit-manipulation patterns (masks, flags, counting bits).
Why it matters
- CPU & Processor Architecture operates directly on these fixed-width encodings — registers are just bit patterns interpreted by an instruction.
- Bitwise tricks are the fastest primitives available in a language: no allocation, no branching (when written carefully), a handful of CPU cycles.
Related Pages
- How Computers Work — Overview
- CPU & Processor Architecture
- C++ operator reference: Bitwise Operators