Re: [PATCH] Kill div64.h dupes, parenthesize do_div() macro params

From: Linus Torvalds (torvalds@osdl.org)
Date: Wed Jul 02 2003 - 00:09:14 EST


On Tue, 1 Jul 2003, Andrew Morton wrote:
>
> By requiring an explicit do_div we are made aware of all those 64-bit
> divides and are made to think about them.

do_div() is NOT a 64-bit divide.

It's a 64/32->64+32 div/mod operation, which is a totally different thing
than a full 64/64 divide, and is usually much faster to compute on most
32-bit architectures.

> Why 64-bit divides in particular were victimised in this manner is a matter
> for speculation ;)

Because gcc historically _cannot_ generate an efficient 64/32->64 divide.
It ends up doing a full 64/64 divide thing.

                Linus

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



This archive was generated by hypermail 2b29 : Mon Jul 07 2003 - 22:00:15 EST