"Tyler Littlefield" <[EMAIL PROTECTED]> wrote:
>
> hello,
> If you multiply two unsigned shorts together, you'll
> get an unsigned short,

No, you won't.

If the range of unsigned short fits into an int, the
two unsigned short values will be promoted to int. The
multiplication will be performed with ints, resulting
in either an int or undefined behaviour if the value
is not in the range of int.

If the range of unsigned short doesn't fit into an int,
then the unsigned short values will be promoted to
unsigned int. The multiplication will be performed
as unsigned int and will result in an unsigned int.
The result cannot overflow; it will be reduced modulo
1 more than UINT_MAX if the result value is outside
the range of unsigned int.

-- 
Peter

Reply via email to