Book companion
Two ways into the same ideas.
Follow a concept through the book, or start with something you want to do. Practise it, explain it, and return to it until it sticks.
1 · Understand → 2 · Explain from memory → 3 · Practise → 4 · Spaced review
Chapter numbers and English book headings follow the supplied contents. Outline-only topics do not have lessons or exercises yet.
CS:APP
Computer Systems: A Programmer’s Perspective 2Representing and Manipulating Information10 sections with practice
CS:APP · Representing and Manipulating Information · Learning-oriented| Section | Concept / topic | Study |
|---|
| 2.1 | Information Storage | |
| 2.1.1 | Hexadecimal Notation | |
| 2.1.2 | Words | Outline only |
| 2.1.3 | Data Sizes | Outline only |
| 2.1.4 | Addressing and Byte Ordering | |
| 2.1.5 | Representing Strings | Outline only |
| 2.1.6 | Representing Code | Outline only |
| 2.1.7 | Introduction to Boolean Algebra | |
| 2.1.8 | Bit-Level Operations in C | |
| 2.1.9 | Logical Operations in C | |
| 2.1.10 | Shift Operations in C | |
| 2.2 | Integer Representations | |
| 2.2.1 | Integral Data Types | Outline only |
| 2.2.2 | Unsigned Encodings | |
| 2.2.3 | Two’s-Complement Encodings | |
| 2.2.4 | Conversions Between Signed and Unsigned | Outline only |
| 2.2.5 | Signed vs. Unsigned in C | Outline only |
| 2.2.6 | Expanding the Bit Representation of a Number | Outline only |
| 2.2.7 | Truncating Numbers | |
| 2.2.8 | Advice on Signed vs. Unsigned | Outline only |
| 2.3 | Integer Arithmetic | |
| 2.3.1 | Unsigned Addition | Outline only |
| 2.3.2 | Two’s-Complement Addition | Outline only |
| 2.3.3 | Two’s-Complement Negation | |
| 2.3.4 | Unsigned Multiplication | Outline only |
| 2.3.5 | Two’s-Complement Multiplication | Outline only |
| 2.3.6 | Multiplying by Constants | Outline only |
| 2.3.7 | Dividing by Powers of Two | Outline only |
| 2.3.8 | Final Thoughts on Integer Arithmetic | Outline only |
| 2.4 | Floating Point | |
| 2.4.1 | Fractional Binary Numbers | Outline only |
| 2.4.2 | IEEE Floating-Point Representation | Outline only |
| 2.4.3 | Example Numbers | Outline only |
| 2.4.4 | Rounding | Outline only |
| 2.4.5 | Floating-Point Operations | Outline only |
| 2.4.6 | Floating Point in C | Outline only |
| 2.5 | Summary | Outline only |
3Machine-Level Representation of ProgramsOutline only
CS:APP · Machine-Level Representation of Programs · Learning-oriented| Section | Concept / topic | Study |
|---|
| 3.1 | A Historical Perspective | Outline only |
| 3.2 | Program Encodings | |
| 3.2.1 | Machine-Level Code | Outline only |
| 3.2.2 | Code Examples | Outline only |
| 3.2.3 | Notes on Formatting | Outline only |
| 3.3 | Data Formats | Outline only |
| 3.4 | Accessing Information | |
| 3.4.1 | Operand Specifiers | Outline only |
| 3.4.2 | Data Movement Instructions | Outline only |
| 3.4.3 | Data Movement Example | Outline only |
| 3.5 | Arithmetic and Logical Operations | |
| 3.5.1 | Load Effective Address | Outline only |
| 3.5.2 | Unary and Binary Operations | Outline only |
| 3.5.3 | Shift Operations | Outline only |
| 3.5.4 | Discussion | Outline only |
| 3.5.5 | Special Arithmetic Operations | Outline only |
| 3.6 | Control | |
| 3.6.1 | Condition Codes | Outline only |
| 3.6.2 | Accessing the Condition Codes | Outline only |
| 3.6.3 | Jump Instructions and Their Encodings | Outline only |
| 3.6.4 | Translating Conditional Branches | Outline only |
| 3.6.5 | Loops | Outline only |
| 3.6.6 | Conditional Move Instructions | Outline only |
| 3.6.7 | Switch Statements | Outline only |
| 3.7 | Procedures | |
| 3.7.1 | Stack Frame Structure | Outline only |
| 3.7.2 | Transferring Control | Outline only |
| 3.7.3 | Register Usage Conventions | Outline only |
| 3.7.4 | Procedure Example | Outline only |
| 3.7.5 | Recursive Procedures | Outline only |
| 3.8 | Array Allocation and Access | |
| 3.8.1 | Basic Principles | Outline only |
| 3.8.2 | Pointer Arithmetic | Outline only |
| 3.8.3 | Nested Arrays | Outline only |
| 3.8.4 | Fixed-Size Arrays | Outline only |
| 3.8.5 | Variable-Size Arrays | Outline only |
| 3.9 | Heterogeneous Data Structures | |
| 3.9.1 | Structures | Outline only |
| 3.9.2 | Unions | Outline only |
| 3.9.3 | Data Alignment | Outline only |
| 3.10 | Putting It Together: Understanding Pointers | Outline only |
| 3.11 | Life in the Real World: Using the gdb Debugger | Outline only |
| 3.12 | Out-of-Bounds Memory References and Buffer Overflow | |
| 3.12.1 | Thwarting Buffer Overflow Attacks | Outline only |
| 3.13 | x86-64: Extending IA32 to 64 Bits | |
| 3.13.1 | History and Motivation for x86-64 | Outline only |
| 3.13.2 | An Overview of x86-64 | Outline only |
| 3.13.3 | Accessing Information | Outline only |
| 3.13.4 | Control | Outline only |
| 3.13.5 | Data Structures | Outline only |
| 3.13.6 | Concluding Observations about x86-64 | Outline only |
| 3.14 | Machine-Level Representations of Floating-Point Programs | Outline only |
| 3.15 | Summary | Outline only |
4Processor ArchitectureOutline only
CS:APP · Processor Architecture · Learning-oriented| Section | Concept / topic | Study |
|---|
| 4.1 | The Y86 Instruction Set Architecture | |
| 4.1.1 | Programmer-Visible State | Outline only |
| 4.1.2 | Y86 Instructions | Outline only |
| 4.1.3 | Instruction Encoding | Outline only |
| 4.1.4 | Y86 Exceptions | Outline only |
| 4.1.5 | Y86 Programs | Outline only |
| 4.1.6 | Some Y86 Instruction Details | Outline only |
| 4.2 | Logic Design and the Hardware Control Language HCL | |
| 4.2.1 | Logic Gates | Outline only |
| 4.2.2 | Combinational Circuits and HCL Boolean Expressions | Outline only |
| 4.2.3 | Word-Level Combinational Circuits and HCL Integer Expressions | Outline only |
| 4.2.4 | Set Membership | Outline only |
| 4.2.5 | Memory and Clocking | Outline only |
| 4.3 | Sequential Y86 Implementations | |
| 4.3.1 | Organizing Processing into Stages | Outline only |
| 4.3.2 | SEQ Hardware Structure | Outline only |
| 4.3.3 | SEQ Timing | Outline only |
| 4.3.4 | SEQ Stage Implementations | Outline only |
| 4.4 | General Principles of Pipelining | |
| 4.4.1 | Computational Pipelines | Outline only |
| 4.4.2 | A Detailed Look at Pipeline Operation | Outline only |
| 4.4.3 | Limitations of Pipelining | Outline only |
| 4.4.4 | Pipelining a System with Feedback | Outline only |
| 4.5 | Pipelined Y86 Implementations | |
| 4.5.1 | SEQ+: Rearranging the Computation Stages | Outline only |
| 4.5.2 | Inserting Pipeline Registers | Outline only |
| 4.5.3 | Rearranging and Relabeling Signals | Outline only |
| 4.5.4 | Next PC Prediction | Outline only |
| 4.5.5 | Pipeline Hazards | Outline only |
| 4.5.6 | Avoiding Data Hazards by Stalling | Outline only |
| 4.5.7 | Avoiding Data Hazards by Forwarding | Outline only |
| 4.5.8 | Load/Use Data Hazards | Outline only |
| 4.5.9 | Exception Handling | Outline only |
| 4.5.10 | PIPE Stage Implementations | Outline only |
| 4.5.11 | Pipeline Control Logic | Outline only |
| 4.5.12 | Performance Analysis | Outline only |
| 4.5.13 | Unfinished Business | Outline only |
| 4.6 | Summary | |
| 4.6.1 | Y86 Simulators | Outline only |
5Optimizing Program PerformanceOutline only
CS:APP · Optimizing Program Performance · Learning-oriented| Section | Concept / topic | Study |
|---|
| 5.1 | Capabilities and Limitations of Optimizing Compilers | Outline only |
| 5.2 | Expressing Program Performance | Outline only |
| 5.3 | Program Example | Outline only |
| 5.4 | Eliminating Loop Inefficiencies | Outline only |
| 5.5 | Reducing Procedure Calls | Outline only |
| 5.6 | Eliminating Unneeded Memory References | Outline only |
| 5.7 | Understanding Modern Processors | |
| 5.7.1 | Overall Operation | Outline only |
| 5.7.2 | Functional Unit Performance | Outline only |
| 5.7.3 | An Abstract Model of Processor Operation | Outline only |
| 5.8 | Loop Unrolling | Outline only |
| 5.9 | Enhancing Parallelism | |
| 5.9.1 | Multiple Accumulators | Outline only |
| 5.9.2 | Reassociation Transformation | Outline only |
| 5.10 | Summary of Results for Optimizing Combining Code | Outline only |
| 5.11 | Some Limiting Factors | |
| 5.11.1 | Register Spilling | Outline only |
| 5.11.2 | Branch Prediction and Misprediction Penalties | Outline only |
| 5.12 | Understanding Memory Performance | |
| 5.12.1 | Load Performance | Outline only |
| 5.12.2 | Store Performance | Outline only |
| 5.13 | Life in the Real World: Performance Improvement Techniques | Outline only |
| 5.14 | Identifying and Eliminating Performance Bottlenecks | |
| 5.14.1 | Program Profiling | Outline only |
| 5.14.2 | Using a Profiler to Guide Optimization | Outline only |
| 5.14.3 | Amdahl’s Law | Outline only |
| 5.15 | Summary | Outline only |
6The Memory HierarchyOutline only
CS:APP · The Memory Hierarchy · Learning-oriented| Section | Concept / topic | Study |
|---|
| 6.1 | Storage Technologies | |
| 6.1.1 | Random-Access Memory | Outline only |
| 6.1.2 | Disk Storage | Outline only |
| 6.1.3 | Solid State Disks | Outline only |
| 6.1.4 | Storage Technology Trends | Outline only |
| 6.2 | Locality | |
| 6.2.1 | Locality of References to Program Data | Outline only |
| 6.2.2 | Locality of Instruction Fetches | Outline only |
| 6.2.3 | Summary of Locality | Outline only |
| 6.3 | The Memory Hierarchy | |
| 6.3.1 | Caching in the Memory Hierarchy | Outline only |
| 6.3.2 | Summary of Memory Hierarchy Concepts | Outline only |
| 6.4 | Cache Memories | |
| 6.4.1 | Generic Cache Memory Organization | Outline only |
| 6.4.2 | Direct-Mapped Caches | Outline only |
| 6.4.3 | Set Associative Caches | Outline only |
| 6.4.4 | Fully Associative Caches | Outline only |
| 6.4.5 | Issues with Writes | Outline only |
| 6.4.6 | Anatomy of a Real Cache Hierarchy | Outline only |
| 6.4.7 | Performance Impact of Cache Parameters | Outline only |
| 6.5 | Writing Cache-friendly Code | Outline only |
| 6.6 | Putting It Together: The Impact of Caches on Program Performance | |
| 6.6.1 | The Memory Mountain | Outline only |
| 6.6.2 | Rearranging Loops to Increase Spatial Locality | Outline only |
| 6.6.3 | Exploiting Locality in Your Programs | Outline only |
| 6.7 | Summary | Outline only |
7LinkingOutline only
CS:APP · Linking · Learning-oriented| Section | Concept / topic | Study |
|---|
| 7.1 | Compiler Drivers | Outline only |
| 7.2 | Static Linking | Outline only |
| 7.3 | Object Files | Outline only |
| 7.4 | Relocatable Object Files | Outline only |
| 7.5 | Symbols and Symbol Tables | Outline only |
| 7.6 | Symbol Resolution | |
| 7.6.1 | How Linkers Resolve Multiply Defined Global Symbols | Outline only |
| 7.6.2 | Linking with Static Libraries | Outline only |
| 7.6.3 | How Linkers Use Static Libraries to Resolve References | Outline only |
| 7.7 | Relocation | |
| 7.7.1 | Relocation Entries | Outline only |
| 7.7.2 | Relocating Symbol References | Outline only |
| 7.8 | Executable Object Files | Outline only |
| 7.9 | Loading Executable Object Files | Outline only |
| 7.10 | Dynamic Linking with Shared Libraries | Outline only |
| 7.11 | Loading and Linking Shared Libraries from Applications | Outline only |
| 7.12 | Position-Independent Code (PIC) | Outline only |
| 7.13 | Tools for Manipulating Object Files | Outline only |
| 7.14 | Summary | Outline only |
8Exceptional Control FlowOutline only
CS:APP · Exceptional Control Flow · Learning-oriented| Section | Concept / topic | Study |
|---|
| 8.1 | Exceptions | |
| 8.1.1 | Exception Handling | Outline only |
| 8.1.2 | Classes of Exceptions | Outline only |
| 8.1.3 | Exceptions in Linux/IA32 Systems | Outline only |
| 8.2 | Processes | |
| 8.2.1 | Logical Control Flow | Outline only |
| 8.2.2 | Concurrent Flows | Outline only |
| 8.2.3 | Private Address Space | Outline only |
| 8.2.4 | User and Kernel Modes | Outline only |
| 8.2.5 | Context Switches | Outline only |
| 8.3 | System Call Error Handling | Outline only |
| 8.4 | Process Control | |
| 8.4.1 | Obtaining Process IDs | Outline only |
| 8.4.2 | Creating and Terminating Processes | Outline only |
| 8.4.3 | Reaping Child Processes | Outline only |
| 8.4.4 | Putting Processes to Sleep | Outline only |
| 8.4.5 | Loading and Running Programs | Outline only |
| 8.4.6 | Using fork and execve to Run Programs | Outline only |
| 8.5 | Signals | |
| 8.5.1 | Signal Terminology | Outline only |
| 8.5.2 | Sending Signals | Outline only |
| 8.5.3 | Receiving Signals | Outline only |
| 8.5.4 | Signal Handling Issues | Outline only |
| 8.5.5 | Portable Signal Handling | Outline only |
| 8.5.6 | Explicitly Blocking and Unblocking Signals | Outline only |
| 8.5.7 | Synchronizing Flows to Avoid Nasty Concurrency Bugs | Outline only |
| 8.6 | Nonlocal Jumps | Outline only |
| 8.7 | Tools for Manipulating Processes | Outline only |
| 8.8 | Summary | Outline only |
9Virtual MemoryOutline only
CS:APP · Virtual Memory · Learning-oriented| Section | Concept / topic | Study |
|---|
| 9.1 | Physical and Virtual Addressing | Outline only |
| 9.2 | Address Spaces | Outline only |
| 9.3 | VM as a Tool for Caching | |
| 9.3.1 | DRAM Cache Organization | Outline only |
| 9.3.2 | Page Tables | Outline only |
| 9.3.3 | Page Hits | Outline only |
| 9.3.4 | Page Faults | Outline only |
| 9.3.5 | Allocating Pages | Outline only |
| 9.3.6 | Locality to the Rescue Again | Outline only |
| 9.4 | VM as a Tool for Memory Management | Outline only |
| 9.5 | VM as a Tool for Memory Protection | Outline only |
| 9.6 | Address Translation | |
| 9.6.1 | Integrating Caches and VM | Outline only |
| 9.6.2 | Speeding up Address Translation with a TLB | Outline only |
| 9.6.3 | Multi-Level Page Tables | Outline only |
| 9.6.4 | Putting It Together: End-to-end Address Translation | Outline only |
| 9.7 | Case Study: The Intel Core i7/Linux Memory System | |
| 9.7.1 | Core i7 Address Translation | Outline only |
| 9.7.2 | Linux Virtual Memory System | Outline only |
| 9.8 | Memory Mapping | |
| 9.8.1 | Shared Objects Revisited | Outline only |
| 9.8.2 | The fork Function Revisited | Outline only |
| 9.8.3 | The execve Function Revisited | Outline only |
| 9.8.4 | User-level Memory Mapping with the mmap Function | Outline only |
| 9.9 | Dynamic Memory Allocation | |
| 9.9.1 | The malloc and free Functions | Outline only |
| 9.9.2 | Why Dynamic Memory Allocation? | Outline only |
| 9.9.3 | Allocator Requirements and Goals | Outline only |
| 9.9.4 | Fragmentation | Outline only |
| 9.9.5 | Implementation Issues | Outline only |
| 9.9.6 | Implicit Free Lists | Outline only |
| 9.9.7 | Placing Allocated Blocks | Outline only |
| 9.9.8 | Splitting Free Blocks | Outline only |
| 9.9.9 | Getting Additional Heap Memory | Outline only |
| 9.9.10 | Coalescing Free Blocks | Outline only |
| 9.9.11 | Coalescing with Boundary Tags | Outline only |
| 9.9.12 | Putting It Together: Implementing a Simple Allocator | Outline only |
| 9.9.13 | Explicit Free Lists | Outline only |
| 9.9.14 | Segregated Free Lists | Outline only |
| 9.10 | Garbage Collection | |
| 9.10.1 | Garbage Collector Basics | Outline only |
| 9.10.2 | Mark&Sweep Garbage Collectors | Outline only |
| 9.10.3 | Conservative Mark&Sweep for C Programs | Outline only |
| 9.11 | Common Memory-Related Bugs in C Programs | |
| 9.11.1 | Dereferencing Bad Pointers | Outline only |
| 9.11.2 | Reading Uninitialized Memory | Outline only |
| 9.11.3 | Allowing Stack Buffer Overflows | Outline only |
| 9.11.4 | Assuming that Pointers and the Objects They Point to Are the Same Size | Outline only |
| 9.11.5 | Making Off-by-One Errors | Outline only |
| 9.11.6 | Referencing a Pointer Instead of the Object It Points to | Outline only |
| 9.11.7 | Misunderstanding Pointer Arithmetic | Outline only |
| 9.11.8 | Referencing Nonexistent Variables | Outline only |
| 9.11.9 | Referencing Data in Free Heap Blocks | Outline only |
| 9.11.10 | Introducing Memory Leaks | Outline only |
| 9.12 | Summary | Outline only |
10System-Level I/OOutline only
CS:APP · System-Level I/O · Learning-oriented| Section | Concept / topic | Study |
|---|
| 10.1 | Unix I/O | Outline only |
| 10.2 | Opening and Closing Files | Outline only |
| 10.3 | Reading and Writing Files | Outline only |
| 10.4 | Robust Reading and Writing with the Rio Package | |
| 10.4.1 | Rio Unbuffered Input and Output Functions | Outline only |
| 10.4.2 | Rio Buffered Input Functions | Outline only |
| 10.5 | Reading File Metadata | Outline only |
| 10.6 | Sharing Files | Outline only |
| 10.7 | I/O Redirection | Outline only |
| 10.8 | Standard I/O | Outline only |
| 10.9 | Putting It Together: Which I/O Functions Should I Use? | Outline only |
| 10.10 | Summary | Outline only |
11Network ProgrammingOutline only
CS:APP · Network Programming · Learning-oriented| Section | Concept / topic | Study |
|---|
| 11.1 | The Client-Server Programming Model | Outline only |
| 11.2 | Networks | Outline only |
| 11.3 | The Global IP Internet | |
| 11.3.1 | IP Addresses | Outline only |
| 11.3.2 | Internet Domain Names | Outline only |
| 11.3.3 | Internet Connections | Outline only |
| 11.4 | The Sockets Interface | |
| 11.4.1 | Socket Address Structures | Outline only |
| 11.4.2 | The socket Function | Outline only |
| 11.4.3 | The connect Function | Outline only |
| 11.4.4 | The open_clientfd Function | Outline only |
| 11.4.5 | The bind Function | Outline only |
| 11.4.6 | The listen Function | Outline only |
| 11.4.7 | The open_listenfd Function | Outline only |
| 11.4.8 | The accept Function | Outline only |
| 11.4.9 | Example Echo Client and Server | Outline only |
| 11.5 | Web Servers | |
| 11.5.1 | Web Basics | Outline only |
| 11.5.2 | Web Content | Outline only |
| 11.5.3 | HTTP Transactions | Outline only |
| 11.5.4 | Serving Dynamic Content | Outline only |
| 11.6 | Putting It Together: The Tiny Web Server | Outline only |
| 11.7 | Summary | Outline only |
12Concurrent ProgrammingOutline only
CS:APP · Concurrent Programming · Learning-oriented| Section | Concept / topic | Study |
|---|
| 12.1 | Concurrent Programming with Processes | |
| 12.1.1 | A Concurrent Server Based on Processes | Outline only |
| 12.1.2 | Pros and Cons of Processes | Outline only |
| 12.2 | Concurrent Programming with I/O Multiplexing | |
| 12.2.1 | A Concurrent Event-Driven Server Based on I/O Multiplexing | Outline only |
| 12.2.2 | Pros and Cons of I/O Multiplexing | Outline only |
| 12.3 | Concurrent Programming with Threads | |
| 12.3.1 | Thread Execution Model | Outline only |
| 12.3.2 | Posix Threads | Outline only |
| 12.3.3 | Creating Threads | Outline only |
| 12.3.4 | Terminating Threads | Outline only |
| 12.3.5 | Reaping Terminated Threads | Outline only |
| 12.3.6 | Detaching Threads | Outline only |
| 12.3.7 | Initializing Threads | Outline only |
| 12.3.8 | A Concurrent Server Based on Threads | Outline only |
| 12.4 | Shared Variables in Threaded Programs | |
| 12.4.1 | Threads Memory Model | Outline only |
| 12.4.2 | Mapping Variables to Memory | Outline only |
| 12.4.3 | Shared Variables | Outline only |
| 12.5 | Synchronizing Threads with Semaphores | |
| 12.5.1 | Progress Graphs | Outline only |
| 12.5.2 | Semaphores | Outline only |
| 12.5.3 | Using Semaphores for Mutual Exclusion | Outline only |
| 12.5.4 | Using Semaphores to Schedule Shared Resources | Outline only |
| 12.5.5 | Putting It Together: A Concurrent Server Based on Prethreading | Outline only |
| 12.6 | Using Threads for Parallelism | Outline only |
| 12.7 | Other Concurrency Issues | |
| 12.7.1 | Thread Safety | Outline only |
| 12.7.2 | Reentrancy | Outline only |
| 12.7.3 | Using Existing Library Functions in Threaded Programs | Outline only |
| 12.7.4 | Races | Outline only |
| 12.7.5 | Deadlocks | Outline only |
| 12.8 | Summary | Outline only |
AError HandlingOutline only
CS:APP · Error Handling · Learning-oriented| Section | Concept / topic | Study |
|---|
| A.1 | Error Handling in Unix Systems | Outline only |
| A.2 | Error-Handling Wrappers | Outline only |
2Basics1 section with practice
Hacker’s Delight · Basics · Learning-oriented| Section | Concept / topic | Study |
|---|
| 2-1 | Manipulating Rightmost Bits | |
| 2-2 | Addition Combined with Logical Operations | Outline only |
| 2-3 | Inequalities among Logical and Arithmetic Expressions | Outline only |
| 2-4 | Absolute Value Function | Outline only |
| 2-5 | Average of Two Integers | Outline only |
| 2-6 | Sign Extension | Outline only |
| 2-7 | Shift Right Signed from Unsigned | Outline only |
| 2-8 | Sign Function | Outline only |
| 2-9 | Three-Valued Compare Function | Outline only |
| 2-10 | Transfer of Sign Function | Outline only |
| 2-11 | Decoding a ‘Zero Means 2**n’ Field | Outline only |
| 2-12 | Comparison Predicates | Outline only |
| 2-13 | Overflow Detection | Outline only |
| 2-14 | Condition Code Result of Add, Subtract, and Multiply | Outline only |
| 2-15 | Rotate Shifts | Outline only |
| 2-16 | Double-Length Add/Subtract | Outline only |
| 2-17 | Double-Length Shifts | Outline only |
| 2-18 | Multibyte Add, Subtract, Absolute Value | Outline only |
| 2-19 | Doz, Max, Min | Outline only |
| 2-20 | Exchanging Registers | Outline only |
| 2-21 | Alternating among Two or More Values | Outline only |
| 2-22 | A Boolean Decomposition Formula | Outline only |
| 2-23 | Implementing Instructions for all 16 Binary Boolean Operations | Outline only |
3Power-of-2 BoundariesOutline only
Hacker’s Delight · Power-of-2 Boundaries · Learning-oriented| Section | Concept / topic | Study |
|---|
| 3-1 | Rounding Up/Down to a Multiple of a Known Power of 2 | Outline only |
| 3-2 | Rounding Up/Down to the Next Power of 2 | Outline only |
| 3-3 | Detecting a Power-of-2 Boundary Crossing | Outline only |
4Arithmetic BoundsOutline only
Hacker’s Delight · Arithmetic Bounds · Learning-oriented| Section | Concept / topic | Study |
|---|
| 4-1 | Checking Bounds of Integers | Outline only |
| 4-2 | Propagating Bounds through Adds and Subtracts | Outline only |
| 4-3 | Propagating Bounds through Logical Operations | Outline only |
5Counting BitsOutline only
Hacker’s Delight · Counting Bits · Learning-oriented| Section | Concept / topic | Study |
|---|
| 5-1 | Counting 1-Bits | Outline only |
| 5-2 | Parity | Outline only |
| 5-3 | Counting Leading 0s | Outline only |
| 5-4 | Counting Trailing 0s | Outline only |
6Searching WordsOutline only
Hacker’s Delight · Searching Words · Learning-oriented| Section | Concept / topic | Study |
|---|
| 6-1 | Find First 0-Byte | Outline only |
| 6-2 | Find First String of 1-Bits of a Given Length | Outline only |
| 6-3 | Find Longest String of 1-Bits | Outline only |
| 6-4 | Find Shortest String of 1-Bits | Outline only |
7Rearranging Bits and BytesOutline only
Hacker’s Delight · Rearranging Bits and Bytes · Learning-oriented| Section | Concept / topic | Study |
|---|
| 7-1 | Reversing Bits and Bytes | Outline only |
| 7-2 | Shuffling Bits | Outline only |
| 7-3 | Transposing a Bit Matrix | Outline only |
| 7-4 | Compress, or Generalized Extract | Outline only |
| 7-5 | Expand, or Generalized Insert | Outline only |
| 7-6 | Hardware Algorithms for Compress and Expand | Outline only |
| 7-7 | General Permutations, Sheep and Goats Operation | Outline only |
| 7-8 | Rearrangements and Index Transformations | Outline only |
| 7-9 | An LRU Algorithm | Outline only |
8MultiplicationOutline only
Hacker’s Delight · Multiplication · Learning-oriented| Section | Concept / topic | Study |
|---|
| 8-1 | Multiword Multiplication | Outline only |
| 8-2 | High-Order Half of 64-Bit Product | Outline only |
| 8-3 | High-Order Product Signed from/to Unsigned | Outline only |
| 8-4 | Multiplication by Constants | Outline only |
9Integer DivisionOutline only
Hacker’s Delight · Integer Division · Learning-oriented| Section | Concept / topic | Study |
|---|
| 9-1 | Preliminaries | Outline only |
| 9-2 | Multiword Division | Outline only |
| 9-3 | Unsigned Short Division from Signed Division | Outline only |
| 9-4 | Unsigned Long Division | Outline only |
| 9-5 | Doubleword Division from Long Division | Outline only |
10Integer Division by ConstantsOutline only
Hacker’s Delight · Integer Division by Constants · Learning-oriented| Section | Concept / topic | Study |
|---|
| 10-1 | Signed Division by a Known Power of 2 | Outline only |
| 10-2 | Signed Remainder from Division by a Known Power of 2 | Outline only |
| 10-3 | Signed Division and Remainder by Non-Powers of 2 | Outline only |
| 10-4 | Signed Division by Divisors ≥ 2 | Outline only |
| 10-5 | Signed Division by Divisors ≤ −2 | Outline only |
| 10-6 | Incorporation into a Compiler | Outline only |
| 10-7 | Miscellaneous Topics | Outline only |
| 10-8 | Unsigned Division | Outline only |
| 10-9 | Unsigned Division by Divisors ≥ 1 | Outline only |
| 10-10 | Incorporation into a Compiler (Unsigned) | Outline only |
| 10-11 | Miscellaneous Topics (Unsigned) | Outline only |
| 10-12 | Applicability to Modulus and Floor Division | Outline only |
| 10-13 | Similar Methods | Outline only |
| 10-14 | Sample Magic Numbers | Outline only |
| 10-15 | Simple Code in Python | Outline only |
| 10-16 | Exact Division by Constants | Outline only |
| 10-17 | Test for Zero Remainder after Division by a Constant | Outline only |
| 10-18 | Methods Not Using Multiply High | Outline only |
| 10-19 | Remainder by Summing Digits | Outline only |
| 10-20 | Remainder by Multiplication and Shifting Right | Outline only |
| 10-21 | Converting to Exact Division | Outline only |
| 10-22 | A Timing Test | Outline only |
| 10-23 | A Circuit for Dividing by 3 | Outline only |
11Some Elementary FunctionsOutline only
Hacker’s Delight · Some Elementary Functions · Learning-oriented| Section | Concept / topic | Study |
|---|
| 11-1 | Integer Square Root | Outline only |
| 11-2 | Integer Cube Root | Outline only |
| 11-3 | Integer Exponentiation | Outline only |
| 11-4 | Integer Logarithm | Outline only |
12Unusual Bases for Number SystemsOutline only
Hacker’s Delight · Unusual Bases for Number Systems · Learning-oriented| Section | Concept / topic | Study |
|---|
| 12-1 | Base −2 | Outline only |
| 12-2 | Base −1 + i | Outline only |
| 12-3 | Other Bases | Outline only |
| 12-4 | What Is the Most Efficient Base? | Outline only |
13Gray CodeOutline only
Hacker’s Delight · Gray Code · Learning-oriented| Section | Concept / topic | Study |
|---|
| 13-1 | Gray Code | Outline only |
| 13-2 | Incrementing a Gray-Coded Integer | Outline only |
| 13-3 | Negabinary Gray Code | Outline only |
| 13-4 | Brief History and Applications | Outline only |
14Cyclic Redundancy CheckOutline only
Hacker’s Delight · Cyclic Redundancy Check · Learning-oriented| Section | Concept / topic | Study |
|---|
| 14-1 | Introduction | Outline only |
| 14-2 | Theory | Outline only |
| 14-3 | Practice | Outline only |
15Error-Correcting CodesOutline only
Hacker’s Delight · Error-Correcting Codes · Learning-oriented| Section | Concept / topic | Study |
|---|
| 15-1 | Introduction | Outline only |
| 15-2 | The Hamming Code | Outline only |
| 15-3 | Software for SEC-DED on 32 Information Bits | Outline only |
| 15-4 | Error Correction Considered More Generally | Outline only |
16Hilbert’s CurveOutline only
Hacker’s Delight · Hilbert’s Curve · Learning-oriented| Section | Concept / topic | Study |
|---|
| 16-1 | A Recursive Algorithm for Generating the Hilbert Curve | Outline only |
| 16-2 | Coordinates from Distance along the Hilbert Curve | Outline only |
| 16-3 | Distance from Coordinates on the Hilbert Curve | Outline only |
| 16-4 | Incrementing the Coordinates on the Hilbert Curve | Outline only |
| 16-5 | Non-Recursive Generating Algorithms | Outline only |
| 16-6 | Other Space-Filling Curves | Outline only |
| 16-7 | Applications | Outline only |
17Floating-PointOutline only
Hacker’s Delight · Floating-Point · Learning-oriented| Section | Concept / topic | Study |
|---|
| 17-1 | IEEE Format | Outline only |
| 17-2 | Floating-Point To/From Integer Conversions | Outline only |
| 17-3 | Comparing Floating-Point Numbers Using Integer Operations | Outline only |
| 17-4 | An Approximate Reciprocal Square Root Routine | Outline only |
| 17-5 | The Distribution of Leading Digits | Outline only |
| 17-6 | Table of Miscellaneous Values | Outline only |
18Formulas for PrimesOutline only
Hacker’s Delight · Formulas for Primes · Learning-oriented| Section | Concept / topic | Study |
|---|
| 18-1 | Introduction | Outline only |
| 18-2 | Willans’s Formulas | Outline only |
| 18-3 | Wormell’s Formula | Outline only |
| 18-4 | Formulas for Other Difficult Functions | Outline only |
AArithmetic Tables for a 4-Bit MachineOutline only
Outline only
BNewton’s MethodOutline only
Outline only
CA Gallery of Graphs of Discrete FunctionsOutline only
Hacker’s Delight · A Gallery of Graphs of Discrete Functions · Learning-oriented| Section | Concept / topic | Study |
|---|
| C-1 | Plots of Logical Operations on Integers | Outline only |
| C-2 | Plots of Addition, Subtraction, and Multiplication | Outline only |
| C-3 | Plots of Functions Involving Division | Outline only |
| C-4 | Plots of the Compress, SAG, and Rotate Left Functions | Outline only |
| C-5 | 2D Plots of Some Unary Functions | Outline only |