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

Question: write a c function that takes a long int y...

Question details

Write a C function that takes a long int y as argument as well as two integers n and m, the function should swap byte i and j of a long int y (64-Bit Integer).and returns a long int.

long int swapBytes(long int y, int i, int j)

Rules:

Not allowed to use division, multiplication, or modulus, relative comparison (<, >, <=, >=), loops, switches, function calls, macros, conditionals (if or ?:)

ALLOWED to use all bit level and logic operations, left and right shifts, addition and subtraction, equality and inequality tests, integer constants, and casting between data types

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