1. Engineering
  2. Computer Science
  3. a write a c function hwkla that takes a long...

Question: a write a c function hwkla that takes a long...

Question details

A: Write a C function hwkla, that takes a long int x as argument as well as two integers n and m, and returns a long int. Here is the function declaration: long int hwkla (long int x, int n, int m); The function should swap byte n and m of a long int x (64-bit integer). A byte is an eight-bit aggregation. For this problem the index of the least significant byte is 0, and the index of the most significant byte 7 (so 0 <= m, n <= 7). So, if x - 0x0123456789ABCDEF (a 64-bit integer), and if you swap two bytes say that are at the 3rd and 5th index, x would now be x-0x0123896745ABCDEF. You are not allowed to use division, multiplication, or modulus. relative comparisons (<, >, <ラ>-), loops, switches, function calls, macros, conditionals (if or ?:) You are allowed to use all bit level and logic operations, left and right shifts addition and subtraction, equality and inequality tests, integer constants (<=255), INT MIN and INT MAX, and casting between data types. (20 points).

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution