[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070321131532.66e7f0e1@freekitty>
Date: Wed, 21 Mar 2007 13:15:32 -0700
From: Stephen Hemminger <shemminger@...ux-foundation.org>
To: Willy Tarreau <w@....eu>, David Miller <davem@...emloft.net>
Cc: rkuhn@....physik.tu-muenchen.de, andi@...stfloor.org,
dada1@...mosbay.com, jengelh@...ux01.gwdg.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: [PATCH 1/2] div64_64 optimization
Minor optimization of div64_64. do_div() already does optimization
for the case of 32 by 32 divide, so no need to do it here.
Signed-off-by: Stephen Hemminger <shemminger@...ux-foundation.org>
--- net-2.6.22.orig/lib/div64.c 2007-03-21 12:03:59.000000000 -0700
+++ net-2.6.22/lib/div64.c 2007-03-21 12:04:46.000000000 -0700
@@ -61,20 +61,18 @@
/* 64bit divisor, dividend and result. dynamic precision */
uint64_t div64_64(uint64_t dividend, uint64_t divisor)
{
- uint32_t d = divisor;
+ uint32_t high, d;
- if (divisor > 0xffffffffULL) {
- unsigned int shift = fls(divisor >> 32);
+ high = divisor >> 32;
+ if (high) {
+ unsigned int shift = fls(high);
d = divisor >> shift;
dividend >>= shift;
- }
+ } else
+ d = divisor;
- /* avoid 64 bit division if possible */
- if (dividend >> 32)
- do_div(dividend, d);
- else
- dividend = (uint32_t) dividend / d;
+ do_div(dividend, d);
return dividend;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists