This preview shows page 1. Sign up to view the full content.
Unformatted text preview: p;& ˜y Value 0x01 0x01 0x00 0x01 That is xˆy will be zero if and only if every bit of x matches the corresponding bit of y. We then exploit the ability of ! to determine whether a word contains any nonzero bit. There is no real reason to use this expression rather than simply writing x == y, but it demonstrates some of the nuances of bit-level and logical operations. Problem 2.11 Solution: [Pg. 40] This problem is a drill to help you understand the different shift operations. x 0xF0 0x0F 0xCC 0x55 Problem 2.12 Solution: [Pg. 43] In general, working through examples for very small word sizes is a very good way to understand computer arithmetic. The unsigned values correspond to those in Figure 2.1. For the two’s complement values, hex digits 0 through 7 have a most signiﬁcant bit of 0, yielding nonnegative values, while while hex digits 8 through F, have a most signiﬁcant bit of 1, yielding a negative value. x << 3 0x80 0x78 0x60 0xA8 x >> 2 (Logical) 0x3C 0x03 0x33 0x15 x >> 2 (Arithmetic) 0xFC 0x03 0xF3 0x15 Ü (Hex)
0 3 8 A F Problem 2.13 Solution: [Pg. 4...
View Full Document
- Spring '10
- The American