Re: [PATCH v2] Btrfs: use do_div to avoid compile errors on 32bit box

From: Linus Torvalds
Date: Sat Aug 20 2011 - 21:05:59 EST


On Sat, Aug 20, 2011 at 5:21 AM, Josef Bacik <josef@xxxxxxxxxx> wrote:
>
> I think Linus was less complaining about how you're dividing here and
> more about the fact that you are.  A divide by 2 is the same as a >> 1.
>  I'll send a patch to fix this.  Thanks,

Indeed. A single-bit 64-bit "double shift" may be a few cycles, but
it's still pretty damn cheap. Especially when compared to a 64x32 bit
divide. We absolutely don't want to do "do_div()" in order to divide
by the constant 2.

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