Question: Please convert this to ARM assembly language // Function to convert hexadecimal to decimal int hexadecimalToDecimal(char hexVal[]) { int len = strlen(hexVal); // Initializing base

Please convert this to ARM assembly language // Function to convert hexadecimal to decimal

int hexadecimalToDecimal(char hexVal[])

{

int len = strlen(hexVal);

// Initializing base value to 1, i.e 16^0

int base = 1;

int dec_val = 0;

// Extracting characters as digits from last character

for (int i=len-1; i>=0; i--)

{

// if character lies in '0'-'9', converting

// it to integral 0-9 by subtracting 48 from

// ASCII value.

if (hexVal[i]>='0' && hexVal[i]<='9')

{

dec_val += (hexVal[i] - 48)*base;

// incrementing base by power

base = base * 16;

}

// if character lies in 'A'-'F' , converting

// it to integral 10 - 15 by subtracting 55

// from ASCII value

else if (hexVal[i]>='A' && hexVal[i]<='F')

{

dec_val += (hexVal[i] - 55)*base;

// incrementing base by power

base = base*16;

}

}

return dec_val;

}

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!