Subject: Re: timeout issue in scsi drivers: mstohz()
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 04/05/2002 18:04:24
On Fri, Apr 05, 2002 at 05:52:37PM +0200, Manuel Bouyer wrote:
> On Fri, Apr 05, 2002 at 12:21:46AM +0100, David Laight wrote:
> > I dislike casts in these sort of cases, I think you will find that
> > 0u is an integer constant - so adding it will force a char or
> > short type to be extended.
>
> OK, this is what I wasn't sure about (would the variable be extended to the
> constant type, or the constant type be shrunk to the variable type; provided
> that this constant can be represented in the variable type).
According to K&R 2 (and gcc) char and short are promoted to int
before any arithmetic is done (interestingly I had thought that one
of the differences between tranditional C and ansi C was that this
was not the case....)
However (a + 1ull) is long long if a is unsigned long.
David
--
David Laight: david@l8s.co.uk