Question: Write a function that starts with a given integer value, then updates two specified ranges of bits, and then prints the updated value. First initialize
Write a function that starts with a given integer value, then updates two specified ranges of bits, and then prints the updated value. First initialize a new variable to the value 17512807u.
Assume we number the bits from 0 as least significant (on the right) to 31 (most significant, on the left). Update bits 18 through 21 with the integer value 8 and bits 10 through 14 with value 17 (decimal). Print the resulting value as an eight digit hexadecimal number to show all of the digits.
You may use ONLY the C operators &, |, ~, and << to form the updated value. You will probably want to form and use a suitable mask for each field.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
