在此代码: unsigned short int i = 3;
unsigned short int x = 30;
unsigned short int z = (~x) >> i;
在第三行似乎它确实第一移位,然后将补体(〜),甚至当我使用括号。 但是,如果我有long取代short不会出现奇怪的结果。它发生在Windows和Unix中。这是为什么?
我正在尝试编写接收整数作为输入并返回2的幂整数列表的ac#方法其总和等于输入整数 例如 Input Integer :15
Output of this should be 1(2^0), 2 (2^1), 4 (2^2), 8 (2^3)
Sum of above integers is 15 = Input Integer
Input Integer :13
Output of t