This is one of the lines I am having in C# app override of WndProc:
int hiWord = unchecked((short)((long)m.LParam >> 16));
if (hiWord != 0)
{
// do something
}
Is it possible that it may throw Arithmetic exception?
This is one of the lines I am having in C# app override of WndProc:
int hiWord = unchecked((short)((long)m.LParam >> 16));
if (hiWord != 0)
{
// do something
}
Is it possible that it may throw Arithmetic exception?
No, it won't throw exceptions, but you need to be fully aware of arithmetic details of right shift operator; that the highest order sign bit will be kept (if LParam
is singed value), and the way long
value will be truncated into short
; that highest 48 order bits will be removed and the rest 16 bits will be returned only.