Why does 0x1217 get extended to the long type even though it has been cast to the unsigned short type?
A1 Even if 0x1217 is cast to the unsigned short type, it is converted to the int type because the value exceeds the range of the unsigned short type due to the following shift operation. That is, this is a matter of operation order. Convert it to the unsigned short type by shifting it first then casting the result.