Question: Consider the following C functions: Assume these are executed as a 32-bit program on a machine that uses twos complement arithmetic. Assume also that right
Consider the following C functions:
Assume these are executed as a 32-bit program on a machine that uses two’s complement arithmetic. Assume also that right shifts of signed values are performed arithmetically, while right shifts of unsigned values are performed logically.
A. Fill in the following table showing the effect of these functions for several example arguments. You will find it more convenient to work with a hexadecimal representation. Just remember that hex digits 8 through F have their most significant bits equal to 1.
B. Describe in words the useful computation each of these functions performs.
int funi (unsigned word) { } return (int) ((word < < 24) >> 24); int fun2 (unsigned word) { } return ((int) word < < 24) >> 24;
Step by Step Solution
3.39 Rating (152 Votes )
There are 3 Steps involved in it
The expressions in these functions are common program idioms for extracting values from ... View full answer
Get step-by-step solutions from verified subject matter experts
