我根据规则进行数字符号替换:逐位反转,然后加 1,但我使用的是整数数据类型而不是 sbyte。编译器如何理解我正在更改符号,
并且不返回值 255?
int operand1 = 0, operand2 = 0;
int result;
operand1 = 0x01; // [0000 0001]
result = ~operand1; // [1111 1110]
result++; // [1111 1111]
Console.WriteLine(" ~ {0} + 1 = {1} ", operand1, result);
输出:“~1 + 1 = -1”