As part of a bit of defensive programming, I would like to use an assert to make sure that when I cast a ULONG into a USHORT variable that I won't be overflowing the size of numbers that a USHORT can handle. Will the following work, do you think? I think it needs the cast to ULONG so that the comparison is done as a ULONG.
#define MAX_USHORT ((ULONG) ~((USHORT) 0x0))
ASSERT(myushortvar <= MAX_USHORT);