324_Book

# With this background in machine level programming we

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

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 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

## This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online