Arm/abs
From ASMBits
Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer.
int abs (int n);
Expected solution length: Around 3 lines.
Sample Input
10 -10
Sample Output
10 10
Write a function that returns the absolute value of its parameter. The parameter is a two's-complement signed integer.
int abs (int n);
Expected solution length: Around 3 lines.
10 -10
10 10
.global _start _start: mov r0, #10 bl abs 1: b 1b // Done .global abs abs: