mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
[mips/*] Fix branching example (#4315)
This commit is contained in:
parent
414ac29188
commit
d208b72f6a
@ -193,7 +193,7 @@ gateways and routers.
|
||||
# Let $s0 = a, $s1 = b, $s2 = c, $v0 = return register
|
||||
ble $s0, $s1, a_LTE_b # if(a <= b) branch(a_LTE_b)
|
||||
ble $s0, $s2, max_C # if(a > b && a <=c) branch(max_C)
|
||||
move $v0, $s1 # else [a > b && a > c] max = a
|
||||
move $v0, $s0 # else [a > b && a > c] max = a
|
||||
j done # Jump to the end of the program
|
||||
|
||||
a_LTE_b: # Label for when a <= b
|
||||
|
@ -188,7 +188,7 @@ lang: uk-ua
|
||||
# Нехай $s0 = a, $s1 = b, $s2 = c, $v0 = повернути регістр
|
||||
ble $s0, $s1, a_LTE_b # якщо (a <= b) розгалуження(a_LTE_b)
|
||||
ble $s0, $s2, max_C # якщо (a > b && a <=c) розгалуження(max_C)
|
||||
move $v0, $s1 # інакше [a > b && a > c] max = a
|
||||
move $v0, $s0 # інакше [a > b && a > c] max = a
|
||||
j done # Перейти в кінець програми
|
||||
|
||||
a_LTE_b: # Мітка розгалуження, коли a <= b
|
||||
|
@ -160,7 +160,7 @@ MIPS(Microprocessor without Interlocked Pipeline Stages)汇编语言是为
|
||||
# 让 $s0 = a, $s1 = b, $s2 = c, $v0 = 返回寄存器
|
||||
ble $s0, $s1, a_LTE_b # 如果 (a <= b) 跳转到 (a_LTE_b)
|
||||
ble $s0, $s2, max_C # 如果 (a > b && a <= c) 跳转到 (max_C)
|
||||
move $v0, $s1 # 否则 [a > b && a > c] max = a
|
||||
move $v0, $s0 # 否则 [a > b && a > c] max = a
|
||||
j done # 跳转到程序结束
|
||||
|
||||
a_LTE_b: # 当 a <= b 时的标签
|
||||
|
Loading…
Reference in New Issue
Block a user