subject

Consider the following implementation of strlen, which returns the length of a zero-terminated string: strlen:
li $v0, 0
top:
lbu $t0, 0($a0)
beqz $t0, ret
addiu $v0, $v0, 1
addiu $a0, $a0, 1
b top
ret:
jr $ra
(a) If strlen is called on a 10-character string, how many dynamic instructions will be executed? Explain your answer.
(b) Below, rewrite the function to reduce the total number of instructions executed (e. g., for a 10-character string). The bigger the reduction, the better.
(c) How many instructions will your solution for (b) execute for a 10-character string? Explain your answer.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:30
Ineed on my history if anyone can check out the last few questions i posted and i will be posting !
Answers: 2
question
Computers and Technology, 22.06.2019 11:00
What are two of the most common reasons that peolpe who need mental health care do not access it?
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print
Answers: 3
question
Computers and Technology, 23.06.2019 00:30
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies.pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
You know the right answer?
Consider the following implementation of strlen, which returns the length of a zero-terminated strin...
Questions
question
Chemistry, 11.03.2021 07:40
question
Mathematics, 11.03.2021 07:40
question
Mathematics, 11.03.2021 07:40
question
Mathematics, 11.03.2021 07:40
question
Biology, 11.03.2021 07:40
Questions on the website: 13722360