This preview shows page 1. Sign up to view the full content.
Unformatted text preview: bits of the product can be computed with the expression x*y, so we only require a procedure with prototype
unsigned int unsigned_high_prod(unsigned x, unsigned y); that computes the high-order Û bits of Ü ¡ Ý for unsigned variables. We have access to a library function with prototype:
int signed_high_prod(int x, int y); that computes the high-order Û bits of Ü ¡ Ý for the case where Ü and Ý are in two’s complement form. Write code calling this procedure to implement the function for unsigned arguments. Justify the correctness of your solution. [Hint:] Look at the relationship between the signed product derivation of Equation 2.18. Homework Problem 2.41 [Category 2]: Suppose we are given the task of generating code to multiply integer variable x by various different constant factors Ã . To be efﬁcient we want to use only the operations +, -, and <<. For the following values of Ã , write C expressions to perform the multiplication using at most three operations per expression. A. B. C....
View Full Document
- Spring '10
- The American