Computer Systems: A Programmer’s Perspective
Instructor’s Solution Manual 1
Randal E. Bryant
David R. O’Hallaron
December 4, 2003
1Copyright c 2003, R. E. Bryant, D. R. O’Hallaron. All rights reserved.
2
Chapter 1
Solutions to Homework Problems
The text uses two different kinds of exercises:
Practice Problems. These are problems that are incorporated directly into the text, with explanatory
solutions at the end of each chapter. Our intention is that students will work on these problems as they
read the book. Each one highlights some particular concept.
Homework Problems. These are found at the end of each chapter. They vary in complexity from
simple drills to multi-week labs and are designed for instructors to give as assignments or to use as
recitation examples.
This document gives the solutions to the homework problems.
1.1 Chapter 1: A Tour of Computer Systems
1.2 Chapter 2: Representing and Manipulating Information
Problem 2.40 Solution:
This exercise should be a straightforward variation on the existing code.
code/data/show-ans.c
1 void show_short(short int x)
2 {
3 show_bytes((byte_pointer) &x, sizeof(short int));
4 }
5
6 void show_long(long int x)
7 {
8 show_bytes((byte_pointer) &x, sizeof(long));
9 }
1
2 CHAPTER 1. SOLUTIONS TO HOMEWORK PROBLEMS
10
11 void show_double(double x)
12 {
13 show_bytes((byte_pointer) &x, sizeof(double));
14 }