This preview shows page 1. Sign up to view the full content.
Unformatted text preview: D. Ü ¡ Ý and the unsigned product Ü¼ ¡ Ý¼ in the Ã Ã Ã Ã : :
½ : : 84 CHAPTER 2. REPRESENTING AND MANIPULATING INFORMATION Homework Problem 2.42 [Category 2]: Write C expressions to generate the following bit patterns, where represents repetitions of symbol . Assume a Û-bit data type. Your code may contain references to parameters j and k, representing the values of and , but not a parameter representing Û. A. B.
Û ¼ .
½¼ Û . Suppose we number the bytes in a Û-bit word from 0 (least signiﬁcant) to Û ½ (most signiﬁcant). Write code for the following C function, that will return an unsigned value in which byte i of argument x has been replaced by byte b.
unsigned replace_byte (unsigned x, int i, unsigned char b); Homework Problem 2.43 [Category 2]: Here are some examples showing how the function should work
replace_byte(0x12345678, 2, 0xAB) --> 0x12AB5678 replace_byte(0x12345678, 0, 0xAB) --> 0x123456AB Homework Problem 2.44 [Category 3]: Fill in code for the following C functions. Function srl performs a logical right shift using an arithmetic right shift (given by value xsra), followed by other...
View Full Document
- Spring '10
- The American