回答編集履歴
2
ソース修正
test
CHANGED
@@ -26,13 +26,13 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
printf("%04hx\n",*(short *)(&data[1]));
|
29
|
+
printf("%04hx\n",*(unsigned short *)(&data[1]));
|
30
30
|
|
31
|
-
printf("%04hx\n",*(short *)(&data[2]));
|
31
|
+
printf("%04hx\n",*(unsigned short *)(&data[2]));
|
32
32
|
|
33
33
|
//
|
34
34
|
|
35
|
-
unsigned short s= data[2] << 8 | data[3];
|
35
|
+
unsigned short s= (unsigned short)(data[2] << 8 | data[3]);
|
36
36
|
|
37
37
|
printf("%04hx\n",s);
|
38
38
|
|
1
誤記修正
test
CHANGED
@@ -32,7 +32,7 @@
|
|
32
32
|
|
33
33
|
//
|
34
34
|
|
35
|
-
unsigned short s= data[
|
35
|
+
unsigned short s= data[2] << 8 | data[3];
|
36
36
|
|
37
37
|
printf("%04hx\n",s);
|
38
38
|
|