Can anyone suggest the correct way to calculate the two's complement from a 16-bit number stored in the ALU?
adiw r24, 1
Is one way, but that takes 4 cycles to complete, and uses adiw, which is not available in all devices.
I saw somewhere that it is possible to use
I thought this can't be true... And it wasn't. Can anyone suggest another algorithm which would complete in 3 cycles, or take less space?