Here's a review sheet for the first test. The ommission of a topic does not mean it is not on the test. You are responsible for class lectures 00-06, homework assignments 1-2, and most of lab1.

Note that the existence of an exam #1 review sheet does not imply the existence of a review sheet for exams #2, #3, and #4. Also, I credit the Bryant and O'Hallaron textbook and slides as providing problems #1 and #2.

- Which of the following are true. x and y are of type int. ux and uy
are of type unsigned int.
- x & 7 == 7 ===> (x<<30) < 0
- x > y ===> -x < -y
- x <= 0 ===> -x >= 0
- x >= 0 ===> -x <= 0

- Write a c-expression to yield a bit string of w-length that sequentially contains w-(k+j) 0's, k 1's, and j 0's.
- Write a c-expression that yields a mask 0xFFFF...FF00FF using each of the following operations once: ~ << |
- Write a c-expression that yields a mask 0xFFFF...FF00FF using each of the following operations once: ~ ^
- Hard and I will not cover myself: Without using control constructs (for, if, etc.), write a function to count the number of binary 0's in a 32-bit integer. For example 0b1111...11110000 would return the integer 4. Restrict yourself to straightline C code, similar to lab 1. Think about how to decompose the problem into multiple operations with results stored in clearly labeled variables.
- Given a floating point format with 1 sign bit, 5 exponent bits, and 5
fraction bits:
- A. give the bit representation for the number 333, using the "round-to-zero" rounding method.
- B. What number does the hexadecimal string 0x558 represent?
- C. What number does the hexadecimal string 0x3F0 represent?

- What is the difference between a normalized and denormalized floating point number? What are the three types of denormalized floating point numbers?
- How many exponent and significand bits are there in an IEEE single-precision (32-bit) floating point number?
- Which register does the x86 architecture use to return a value from a subroutine?
- When making a function call, does gcc push arguments from right to left or from left to right?
- Write C-code for the following assembly:
.file "for.c" .text .globl foo .type foo, @function foo: pushl %ebp movl %esp, %ebp subl $4, %esp movl $0, -4(%ebp) .L2: cmpl $99, -4(%ebp) jle .L5 jmp .L3 .L5: movl 12(%ebp), %eax addl %eax, 8(%ebp) leal -4(%ebp), %eax incl (%eax) jmp .L2 .L3: movl 8(%ebp), %eax leave ret .size foo, .-foo .section .note.GNU-stack,"",@progbits .ident "GCC: (GNU) 3.3.4"