On Tue, Feb 07, 2006 at 04:15:31PM +0100, Andi Kleen wrote:
> On Tuesday 07 February 2006 15:54, Benjamin LaHaise wrote:
>
> > + if (size > ((sk->sk_sndbuf >> 1) - 64))
> > + size = (sk->sk_sndbuf >> 1) - 64;
>
> This is really surprising. Are you double plus sure gcc doesn't
> do this automatically?
As I said, sk_sndbuf is a signed integer, so gcc can't use an arithmetic
shift (which would round to infinity if the result is negative -- gcc has
no way of knowing that sk_sndbuf will be positive). The alternative would
be to convert sk_sndbuf to unsigned, but that would mean rechecking all the
users for side effects.
-ben
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html