Wednesday, February 16, 2011

negation without multiplying

To negate an integer x one can simply do ~x+1. To see why this works consider ~x = -1U - x which is equivalent to ~x+1 = -x

No comments:

Post a Comment