Messages in this thread | | | Subject | Re: Recent change in tcp_output.c is surely wrong | Date | Tue, 18 Jan 2000 10:17:12 +0100 (MET) | From | (Rogier Wolff) |
| |
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
David,
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 #else /* But if you want to benchmark it, here is the classical implementation */ #define CLEAR_BIT_31(var) var &= 0x7fffffff #endif
var = CLEAR_BIT_31(var);
everybody knows what you are doing without having to ask you....
Roger.
-- ** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +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 majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |