Day 4 Flashcards
1
Q
Let r1 be holding some number x .
Save in r2 the remainder of the division of x by 8.
A
andi r2, r1, 7
2
Q
How can you multiply two numbers x and y?
A
3
Q
What is the idea behind counting the number of ones in a number?
A
perform shl 32 times, if the number is negative - increase the counter of ones.
4
Q
what is the idea behind moving through an array of 2048 number and changing them to their absolute values?
A
- set register to 2048 and decrease it by 1 with every iteration. stop in zero.
- if the number is positive: brpl, go to the next iteration
- else, perform the neg instruction.