: : : : i am trying to find the code to perform multiplication and a logical right shift on two unsigned integers.
: : : :
: : : What do you mean by LC3? Is this the Little Computer 3? The HP server? Or something else?
: : :
: : : ~Sparrow
: : :
: : Hi,
: : I'm interested to find out how to shift right in LC3 as well. I'm not sure what's LC3, but basically there's only three operators that can be used to shift bits to the right. They are AND, ADD and NOT.
: : I only know that to shift to right, we need to divide the number by half. But in LC3, there's no divide operatior. So we need to make use of the three operators to do the shifting.
: : Any experts here that knows hoa to do that?
: : Thanks.
: By the way, just found out that LC3 is little computer 3. Yeah u're right. Any one can advise on the shift right ?
I just got this book as well, and I have been stuck on that exercise for a while. I can't really think of a very efficient way to do a right shift with only ADD, AND, and NOT. I don't really know that I've solved the problem, but I have a theory. See if this works:
* A left shift is easy
* A left rotate is a little harder, but not much
* N - 1 left rotates is equivalent to a right rotate
* A right rotate with the MSB cleared is equivalent to a right shift