Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am unsure of the procedure to convert numbers from one bit amountto another. T

ID: 3608032 • Letter: I

Question

I am unsure of the procedure to convert numbers from one bit amountto another. To provide an example of a few questions I wouldlike to see demonstrated the following problems apply:

Convert the following 2's complement 16 bit number to a 32 bitnumber:

3EAF                       (Hexadecimal)


Convert the following 8 bit 2's complement number to a 16 bitnumber:

01011010                 (binary)


If someone could answer these two problems and explain the processof doing it to me I would greatly appreciate it!

Please help me out.
Thanks.

Explanation / Answer

//Here is the logic ofconversion. I am using the C syntax. Hope this will help you..
// & --> bit wise and
// | --> bit wise or




Here is the logic to convert 8 bit 2's complement to16 bit 2's complement.
Assume num8,temp8 and num16 are two 8bit and one 16bit 2's complement numbers.

temp16 = num8 & 0x7F;
if(num8 &0x8000)        /*Msb of the -ve number is 1 in 2's complementformat */
{
/*Number is -ve*/
num16 = temp16|0xFF80;            /* just copy the value and make alldigit 1 */
}else
{

/*Number is +ve*/
num16 = temp16;
}











16 bit to 32bit.
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote