Re: [Patch] performance enhancement for simple_strtoul

Alan Cox
2000-12-21T16:36:06Z

> On Wed, 20 Dec 2000, Steve Grubb wrote:
>
> > + while (isdigit(c)) {
> > + result = (result*10) + (c & 0x0f);
> > + c = *(++cp);
> > + }
>
> x * 10 can be written as:
>
> (x << 2 + x) << 1 = (4x+x) * 2
> (x << 3) + (x << 1) = 8x + 2x

Since when has printk been performance critical. It isnt worth microoptimising
(or in your case for some cpus micropessimising) that stuff. Besides, gcc should
work it out if its worth doing