This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center。
6年前关闭。
在Obfuscated C Code Contest 2006. Please explain sykes2.c中,
有一个语句“
有人可以解释为什么会这样吗?
6年前关闭。
在Obfuscated C Code Contest 2006. Please explain sykes2.c中,
有一个语句“
-~i == i+1
因为二进制补码”。有人可以解释为什么会这样吗?
最佳答案
-~x
等于x+1
,因为~x
等同于(0xffffffff-x)
。这等于2秒补码中的(-1-x)
,因此-~x
是-(-1-x) = x+1
。