Question: 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

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

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!