Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions