[lkml]   [2000]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Recent change in tcp_output.c is surely wrong
David S. Miller wrote:

[var = (var << 1) >> 1; ]

> So on Sparc there would be two options:
> 1) sethi %hi(0x80000000), %reg1
> andn %ato, %reg1, %result
> 2) sll %ato, 1, %reg1
> srl %reg1, 1, %result


I agree with you on the efficiency issues. The thing is code "costs"
more in the maintenance phase than in the writing phase. So, making it
readable is important.

If you write:

#if 1
/* Clearing bit 31 is faster on some architectures if you do it this
way. At least it isn't slower. */
#define CLEAR_BIT_31(var) var = (var << 1) >> 1
/* But if you want to benchmark it, here is the classical implementation */
#define CLEAR_BIT_31(var) var &= 0x7fffffff

var = CLEAR_BIT_31(var);

everybody knows what you are doing without having to ask you....


** ** ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
"I didn't say it was your fault. I said I was going to blame it on you."

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:56    [W:0.081 / U:2.624 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site