问题
I have to check if a number is even or odd.
My strategy:
- a number is even if ends with 0
- a number is odd if ends with 1
How do I compare the last digit of a register value to a 0 or to a 1 ?
I tried:
andi $t7, $t0, 0 # where $t0 = 3 in decimal so should be 0b11
it doesnt work :( Any hint?
来源:https://stackoverflow.com/questions/13772552/compare-the-last-binary-digit-to-1-in-mips-assembly