Question: 1 ) Recursion Write an assembly function dumb ( a , b ) that takes two unsigned integer arguments and implements this recursive calculation (
Recursion
Write an assembly function dumba b that takes two unsigned integer arguments and implements this recursive calculation thats called "dumb" because it does a dumb calculation that makes no sense, but that's the task:
def dumba b:
if a :
return b
elif b :
return a
else:
return a a b dumba b
You must use the stack to store the a and b values across the recursive call.
pass these tests:
printfdumbli
dumb;
printfdumbli
dumb;
printfdumbli
dumb;
printfdumbli
dumb;
Unsigned Overflow
Write an assembly function largestpowerunsigned that takes an unsigned integer as its argument and returns the largest power of that number that's representable as a bit unsigned integer.
In order to find that value, you need to repeatedly multiply by
until you see an unsigned overflow and return the value before you saw the overflow.
The value you return p
should be a power of n
so ni p
for some i
such that p
and np
But you can't detect it with math: you need to calculate and watch the carry flag.
so it passes the tests:
printflargestpowerunsignedlu
largestpowerunsigned;
printflargestpowerunsignedlu
largestpowerunsigned;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
