Re: [RFC] div64_64 support

From: Eric Dumazet
Date: Tue Mar 06 2007 - 09:19:44 EST


On Tuesday 06 March 2007 14:34, Andi Kleen wrote:

> - return x;
> + int s;
> + u32 y;
> + u64 b;
> + u64 bs;
> +
> + y = 0;
> + for (s = 63; s >= 0; s -= 3) {
> + y = 2 * y;
> + b = 3 * y * (y+1) + 1;
> + bs = b << s;
> + if (x >= bs && (b == (bs>>s))) { /* avoid overflow */
> + x -= bs;
> + y++;
> + }
> + }
> + return y;
> }
>

Andi

<rant>
Let me see... You throw code like that and expect someone to actually
understand it in one year, and be able to correct a bug ?
</rant>

Please add something, an URL or even better a nice explanation, per favor...

Thank you
-
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/