xorpd-solutions

View on GitHub

0x06

[dec] [home] [inc]

[See this riddle on the book]

not      rax
inc      rax
neg      rax
See explanation ## nop This snippet is equivalent to.. doing nothing. `not` flips all the bits, which is equivalent to doing the [one's complement](https://en.wikipedia.org/wiki/Ones%27_complement) of a number. `inc` increments by one. `not` does the [two's complement](https://en.wikipedia.org/wiki/Two%27s_complement). In practice a two's complement is equivalent to a one's complement + 1, so the last operation neutralizes the first two.

[dec] [home] [inc]