回答編集履歴
2
refine
test
CHANGED
@@ -27,3 +27,15 @@
|
|
27
27
|
|
28
28
|
|
29
29
|
(Teratail/Markdownの制約から 2のn乗 を 2^n と表記しています)
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
下記StackOverflowのQ&Aもご参考に:
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
* [interpret signed as unsigned](https://stackoverflow.com/q/1751346/684921)
|
38
|
+
|
39
|
+
* [Using -1 as a flag value for unsigned (size_t) types](https://stackoverflow.com/q/22801069/684921)
|
40
|
+
|
41
|
+
* [Is there a difference between -1 and ~0?](https://stackoverflow.com/q/24650019/684921)
|
1
refine
test
CHANGED
@@ -18,7 +18,11 @@
|
|
18
18
|
|
19
19
|
|
20
20
|
|
21
|
-
|
21
|
+
同Noteは、符号付き整数が2の補数表現の場合、ビット幅切詰めが生じない限り、この変換でビットパターンが保持されるという(ある意味自明な)補足説明になっています。
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
> If the destination type is unsigned, the resulting value is the least unsigned integer congruent to the source integer (modulo 2^n where n is the number of bits used to represent the unsigned type). [Note: In a two's complement representation, this conversion is conceptual and there is no change in the bit pattern (if there is no truncation). -- end note]
|
22
26
|
|
23
27
|
|
24
28
|
|