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

Linus Torvalds (torvalds@osdl.org)
Tue, 1 Jul 2003 22:09:14 -0700 (PDT)


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/