Re: [PATCH] Reduce the number of expensive division instructionsdone by _parse_integer()

From: Eric Dumazet
Date: Thu Feb 09 2012 - 11:42:06 EST


Le jeudi 09 fÃvrier 2012 Ã 17:28 +0100, Eric Dumazet a Ãcrit :

> You could avoid the divide and have cleaner code I think.
>
> unsigned long long next = *res * base + val;
>
> if (next < *res)
> overflow = 1;
> *res = next;
>

Oh well, this one is better.

unsigned long long next = *res * base;

if (next < *res)
overflow = 1;
*res = next + val;




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/