With this background in machine level programming we

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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 significant) to Û ½ (most significant). 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

Ask a homework question - tutors are online