On Sat, Sep 28, 2013 at 09:58:33PM +0200, Ingo Molnar wrote:
> 
> * Borislav Petkov <[email protected]> wrote:
> 
> > On Sat, Sep 28, 2013 at 09:49:27PM +0200, Borislav Petkov wrote:
> > > And yes, that one works too.
> > 
> > Btw, just to be thorough, we could handle negative numbers too:
> > 
> > int num_digits(int val)
> > {
> >         int m = 10;
> >         int d = 1;
> > 
> >         if (val < 0)
> >                 val = -val;
> > 
> >         while (val >= m) {
> >                 m *= 10;
> >                 d++;
> >         }
> > 
> >         return d;
> > }
> 
> I like the cell phone version better!

This *is* the cell phone version + negative numbers handling.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to