Re: Recent change in tcp_output.c is surely wrong

From: Matthew Wilcox (willy@thepuffingroup.com)
Date: Mon Jan 17 2000 - 15:53:04 EST


On Mon, Jan 17, 2000 at 05:49:43PM +0100, Jamie Lokier wrote:
> I noticed this in pre-patch-2.3.40-4.gz:
>
>
> /* Stay within the limit we were given */
> - timeout = tp->ato;
> + timeout = (tp->ato << 1) >> 1;
> if (timeout > max_timeout)
> timeout = max_timeout;
>
> What is the point of this?
>
> - If tp->ato has bit 31 set, then the effect depends on the width of `int'.
> (Because all arithmetic operations in C extend to `int' width first).
>
> - If tp->ato is bit 31 clear, this has no effect.
>
> If the intention is to clear bit 31, `&= 0x7fffffff' is the thing which
> works and is probably more efficient.

and `&= (1U<<31)' is more obvious. Using a symbolic constant would be even
better.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jan 23 2000 - 21:00:16 EST