Question

# Write code for a function with the following prototype:

// Divide by power of two. Assume 0 <= k <

w-1

int divide_power2(int x, int k);

The function should compute x/2 k with correct rounding (round toward 0), and it should follow the bit-level integer coding rules:

• Assumptions

- Integers are represented in twos-complement form.

- Right shifts of signed data are performed arithmetically.

- Data type int is w bits long. For some of the problems, you will be given a specific value for w, but otherwise your code should work as long as w is a multiple of 8. You can use the expression sizeof(int), =).

• Not allowed

- Conditionals (if or ?:), loops, switch statements, function calls, and macro invocations.

- Division, modulus, and multiplication

- Relative comparison operators (, =).

- Casting, either explicit or implicit.

• Allowed operations

- All bit-level and logic operations.

- Left and right shifts, but only with shift amounts between 0 and w − 1.

- Addition and subtraction.

- Equality (==) and inequality (!=) tests. (Some of the problems do not allow these.)

- Integer constants INT_MIN and INT_MAX.

Please properly document the code and what any significant lines perform

### Recently Asked Questions

- Suppose we have a relation in which we want to record for each person their name, Social Security number, and birthdate. Also, for each child of the person,

- Discuss the relative merits of traditional signature-based IDS/IPS technology with newer form, such as application awareness and anomaly detection.

- this is my code elif userchoice == 'W': print ('What would you like to do?\n') print ('How much would you like to withdraw today?\n') # should not allow