This preview shows page 1. Sign up to view the full content.
Unformatted text preview: A. What is wrong with this code? B. Give a correct implementation of the function that uses only left and right shifts, along with one subtraction. Homework Problem 2.38 [Category 1]: Fill in the following table showing the effects of complementing and incrementing several 5-bit vectors, in the style of Figure 2.20. Show both the bit vectors and the numeric values. 2.5. SUMMARY 83 Ü
¼½½¼½ ¼½½½½ ½½¼¼¼ ½½½½½ ½¼¼¼¼ ˜Ü Ò Ö ´˜Üµ Homework Problem 2.39 [Category 2]: Show that ﬁrst decrementing and then complementing is equivalent to complementing and then incrementing. That is, for any signed value x, the C expressions -x, ˜x+1, and ˜(x-1) yield identical results. What mathematical properties of two’s complement addition does your derivation rely on? Homework Problem 2.40 [Category 3]: Suppose we want to compute the complete ¾Û-bit representation of Ü ¡ Ý , where both Ü and Ý are unsigned, on a machine for which data type unsigned is Û bits. The low-order Û...
View Full Document
- Spring '10
- The American