lkml.org 
[lkml]   [2000]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Recent change in tcp_output.c is surely wrong
On Tue, Jan 18, 2000 at 10:27:48AM -0500, Richard B. Johnson wrote:
> Well it's a problem if it doesn't work.
> int foo0 (int bar)
^^^
> {
> return bar & 0x7fffffff;
> }
>
> int foo1 (int bar)
^^^
> {
> return ((bar << 1) >> 1);
> }
>
> int main()
> {
> int xxx = 0xffffffff;
^^^
> printf("%d\n", foo0(xxx));
> printf("%d\n", foo1(xxx));
> return 0;
> }

> So, the double-shift is truly broken. Just AND it and be done with it.

int is signed. the discussion relates to unsigned ints.

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site