127: int a = 2815;
00007FF78B5126EE mov dword ptr [a],0AFFh
128:
129: short c = static_cast<char>(a);
00007FF78B5126F5 movsx ax,byte ptr [a]
00007FF78B5126FA mov word ptr [c],ax
In my environment an int takes 4 byte and a short takes 2, so in the movsx instruction, why there is a byte not a word? Hope someone can help me!
A
charis one byte. Thestatic_castcastsato achar. One byte. Hence, the one-byte value of thechar-cast variableais moved intoax.