Question: Here is a function written in C, which finds the position of the first value of the array which equals val. If none of

Here is a function written in C, which finds the position of

Here is a function written in C, which finds the position of the first value of the array which equals val. If none of the values in the array equal val, it returns -1. int findval (int val, int array[], int size) { int i; // index into array for (i = 0; i < size; i if (array[i] return i; i+1) %3D val) return -1; } Please re-write this function in ARM Thumb assembly code, aiming for the fewest instructions. Let the inputs be RO=val R1=the memory address of the array R2=size And the output should be returned in R0

Step by Step Solution

3.48 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To rewrite the given C function in ARM Thumb assembly language you should keep the loop and comparis... View full answer

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 Programming Questions!