Question

In Legv8 assembly implement a swap procedure that swaps the values in two different 8-byte integers...

In Legv8 assembly implement a swap procedure that swaps the values in two different 8-byte integers in memory.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The swap in high level program will look like this,

swap(int a, int b)

{

        int temp = a;

        a = b;

         b = temp;

}

This can be rewritten in legv8 assembly code as follows

LDURB X0, a    // Loading the value of 'a' in X0

LDURB X1, b   // Loading the value of 'b' in X1

STURB X1, a   // Storing the value of 'b' (ie, X1) to 'a'

STURB X0, b    // Storing the value of 'a' (ie, X0) to 'b'

Add a comment
Know the answer?
Add Answer to:
In Legv8 assembly implement a swap procedure that swaps the values in two different 8-byte integers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT