Friday, 15 July 2011

Assembly code: Add and xor logic -



Assembly code: Add and xor logic -

i'm looking @ puzzle in textbook , i'm not sure if i'm interpreting assembly instructions correctly. way have understood it, it's telling me find 2 numbers sum 6005 , xor give 0.

doesn't mean numbers equal each other? how can be, given sum 6005? possible find pair of such numbers, or have interpreted assembly code incorrectly? allow me know think! thanks.

these statements contradictory :

let's assume xor 0 , sum 6005; means both number equal;

both numbers either pair or impair

assuming pair: 2k + 2k = 4k = 2(2k) = 2k = pair number

assuming impair 2k + 1 + 2k + 1 = 4k + 2 = 2 (2k + 1) = 2k = pair number

6005 = 2 (3002) + 1 = 2k + 1 = impair number.

so it's impossible.

assembly

No comments:

Post a Comment