On Fri, 7 Feb 2003, Richard B. Johnson wrote:
> If the code is correct, it really should be written as:
>
> for (new2size = 128; new2size < newsize; new2size <<= 1)
> ;
>
> The code seems to want to make the value of new2size a power of
> 2 and, greater than 128, but less than newsize. It ignores the
> fact that newsize might be less than 128, maybe this is okay.
Power of two - yes. Greater than 128 no, if newsize were <=128 new2size
would not increment. Previous code may make newsize larger (and later
limit new2size) but not here. And new2size can be equal to newsize, again
by this code.
A comment like /*empty_loop*/ before the semicolon would help human
readability. Code should be readable by humans, too.
-- bill davidsen <davidsen@tmr.com> CTO, TMR Associates, Inc Doing interesting things with little computers since 1979.- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Feb 15 2003 - 22:00:30 EST