I think the behavior of casting method from signed integer to larger unsigned integer like
Short.toUInt() is not clear from function name because we can think two behaviors below:
- cast to larger signed integer the first then cast to unsigned.
- cast to unsigned integer the first then cast to larger unsigned.
Those behaviors are not same if the value is a negative integer.
In the first behavior, upper bits are filled with 1 but 0 in the second behavior.
In my opinion, this can make many bugs so it should not be used and everyone should explicitly cast in two steps like
So I think those methods should be deprecated.