2013-03-11 6 views
-5

아래의 C 코드를 MIPS 코드로 변환 할 수있는 사람이 있습니까? 재귀를 사용하고 21-2를 최종 답으로 사용하기로되어 있습니다. 감사! 여기C to MIPS convert

/* 
x is a pointer to a linked list node and is not null. 
Return the min value stored in the linked list. 

Assume each node is stored in memory as an int (value) followed by a pointer to the next node (next), each a word wide. 
You must write it with recursion. */ 

int findMin(node *x) { 
    if(x->next == NULL) 
     return x->value; 
    else { 
     int min = findMin(x->next); 
     if(min < x->value) 
      return min; 
     else 
      return x->value; 
    } 
} 
+6

... 컴파일러를 사용합니까? –

+1

이 숙제가 있습니까? – tjameson

+0

@tjameson 주석의 두 번째 단락은 교수 나 TA가 사용하는 구절입니다. –

답변

3

당신은 다음과 같습니다

mips-linux-gnu-gcc -S -o foo.asm foo.c 
+2

트롤 태그를 수여 할 방법이 있습니까? –

+0

@EricUrban 진심으로 감사드립니다. 그것은 성취의 무언가 일 것입니다. –

+0

나는이 사람이 gcc 컴파일러의 결과물을 숙제로 바꿔주기를 바라고 있습니다. 그의 교수는 매우 인상 깊고, 혼란 스럽거나, 그냥 실패하고 계속 나아갈 것입니다. –