Re: [Patch] performance enhancement for simple_strtoul

Bernd Schmidt
2000-12-21T10:59:33Z

On Thu, 21 Dec 2000, Matthias Andree wrote:
>
> x * 10 can be written as:
>
> (x << 2 + x) << 1 = (4x+x) * 2
> (x << 3) + (x << 1) = 8x + 2x

Or as "x * 10". Which has the advantage of actually being readable, and
letting the compiler optimize it into one of the other forms if that's
profitable on the machine you are compiling for.

Why do you guys bother making strtoul run fast anyway? Surely it's not on
any critical path in the kernel?

Bernd