Computers and Technology

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:50, edenlbarfield
Which are steps taken to diagnose a computer problem? a) reproducing the problem and using error codes b) reproducing the problem and troubleshooting c) using error codes and troubleshooting d) using error codes and stepping functions
Answers: 1
image
Computers and Technology, 22.06.2019 18:30, yeeet26
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
image
Computers and Technology, 22.06.2019 22:40, nsuleban9524
When you type the pwd command, you notice that your current location on the linux filesystem is the /usr/local directory. answer the following questions, assuming that your current directory is /usr/local for each question. a. which command could you use to change to the /usr directory using an absolute pathname? b. which command could you use to change to the /usr directory using a relative pathname? c. which command could you use to change to the /usr/local/share/info directory using an absolute pathname? d. which command could you use to change to the /usr/local/share/info directory using a relative pathname? e. which command could you use to change to the /etc directory using an absolute pathname? f. which command could you use to change to the /etc directory using a relative pathname?
Answers: 3
image
Computers and Technology, 23.06.2019 08:00, ionmjnm3041
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
Do you know the correct answer?
Consider the following implementation of strlen, which returns the length of a zero-terminated strin...

Questions in other subjects: