Messages in this thread | | | Subject | Re: [PATCH] Reduce the number of expensive division instructions done by _parse_integer() | From | Eric Dumazet <> | Date | Thu, 09 Feb 2012 17:42:02 +0100 |
| |
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |