Arm/maxs8

From ASMBits

Write a function that returns the maximum value out of an array of 8-bit signed bytes.

The function has two parameters. The first parameter is the length of the array (at least 1). The second parameter is a pointer to the beginning of the array.

int max ( unsigned int length, char *array );


Sample Input

[1, 2, 3]

Sample Output

r0=3

Write your solution here

x
 
1
// A test case to test your function with
2
.data
3
Array: .byte 1, 2, 3
4
5
.text
6
.global _start
7
_start:
8
    ldr r0, =3 
9
    ldr r1, =Array
10
    bl max
11
    b _start        // End of testing code
12
13
// Return maximum element of unsigned array
14
max:
15
    
16
    
Upload a source file...