Question: This is a MIPS assembly question. How do I wirte this in MIPS? The C code for this question is twos(int x, char p[]) {

This is a MIPS assembly question.

How do I wirte this in MIPS?

This is a MIPS assembly question. How do I wirte this inThe C code for this question is

twos(int x, char p[])

{ int z= abs(x); int i=0,j; //binary of absolute while(z!=0){ int r = z%2; p[i]= '0'+r; i++; z= z/2; } j=i; //1's complement while(i!=0)

{ i--; if(p[i]=='0')

{ p[i]='1'; } else

{ p[i]='0'; } } //2's complement int xx=0; for(i=0;i

{ if(p[i]=='0')

{ xx=1; p[i]='1'; break; } else

{ p[i]='0'; } } if(xx==0)

{ p[j]='1'; while(j>=0)

{ cout0)

{ j--; cout o Write a non-leaf function to convert a negative integer number to 2's complement in string Two parameters: integer number, string array or pointer "Get absolute value of the negative number Call a function that you implement from part l Flip each binary bit of the string (do 1's complement): '0' f-> 1' - Add 1 to LSB Repeat adding a carry to higher bit o Write a non-leaf function to convert a negative integer number to 2's complement in string Two parameters: integer number, string array or pointer "Get absolute value of the negative number Call a function that you implement from part l Flip each binary bit of the string (do 1's complement): '0' f-> 1' - Add 1 to LSB Repeat adding a carry to higher bit

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!