1. Engineering
  2. Computer Science
  3. its a computer system course just explain the answer and...

Question: its a computer system course just explain the answer and...

Question details

int byteSwap(int x, int n, int m) //In a & b we get the entire byte by shifting left by 3 (visualise it) //He shift 0xFF by a and OR İt with 0xFF shifter by b and get the complement //Then we shift everything again by a, and & with 0xFF to get our new bytes //Then we return the given bytes swapped int a- n<<3 int b- m< <3 int flip ~((0xFF << a) | (0xFF << b) ); int firstbyte (x >> a ) & 0xff; int secondbyte- (x>> b) & 0xFF return (x & flip) I ((secondbyte << a) (firstbyte <<b)); addok-Determine if can compute xty without overflow Example: addoK (0x80000000,0x80000000)0, addoK (0x80000000,0x70000000) 1, Legal ops: -& A+<< >> Max ops: 20 Rating: 3 int addoK(int x, int y) t //we XOR the sign of x and y, returns 1 if same //Compare sign of x with the sum of x and y //bang bang return, not sure why but works return ((((x>>31) (y31))) & (((xy)31) (x>31))) * conditional same as x y z conditional(2,4,5) Legal ops: -& A+<< >> Example: 4 Max ops: 16 Rating: 3It's a computer system course. Just explain the answer and If u were asked to do this, how would you approach the answer Just explain each function.

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