|
-
Oct 9th, 2006, 08:27 AM
#1
Thread Starter
Hyperactive Member
bit or'ing question [RESOLVED]
Hello everyone.
I had a quick question for the following
Assume $t0 holds 0x12001F10 after executing the instruction 'ori $t0, $t0, 784', which is the possible value of $t0 before executing this instruction?
A. 0x12001B11
B. 0x12000C00
C. 0x12001B10
D. 0x12001C00
The answer is infact D.
But i must have made a lucky guess i thought u solved this problem by doing the following:
converting 0x12001F10 to binary, and then converting each of A-D and or'ing each one with $t0, and if you come out with the address in $t0 = 0x12001F10 you've selected the right one. But if u say convert B to binary and or that with $t1 you still come out with $t1 even though B is inncorrect so that can't be the method. So i thought maybe you convert the number 784 and or that with the value in $t1, but this is also incorrect, you'll just end up getting 0x12001F10 which isn't even a choice but its what u started out with.
So finally I converted 784 to binary and or'ed that with each poisslbe answer and I figured it out while typing this message. Is there an easier way to get the answer rather than just elimination? On the exam i doubt i will have enough ttime to convert each choice to its equivlent binary form and or it with the number given if she has more than 4 choices.
Code:
0000 0000 0000 0000 0011 0001 0000 784
0001 0010 0000 0001 1110 0000 0000 0x12001C00
0001 0010 0000 0001 1111 0001 0000 ori
1 2 0 1 F 1 0
which is what $t0 holds
Last edited by voidflux; Oct 9th, 2006 at 12:03 PM.
C¤ry Sanchez
Computer Science/Engineering
@ Penn State
IBM.zSeries Intern
Mandriva 2007
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|