Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=22b9a0a3a49ab1a856e0853b3f3dd2abd156bd7c Commit: 22b9a0a3a49ab1a856e0853b3f3dd2abd156bd7c Parent: c454673da7c1d6533f40ec2f788023df9af56ebf Author: Stephen Hemminger <[EMAIL PROTECTED]> AuthorDate: Thu Mar 22 12:10:18 2007 -0700 Committer: David S. Miller <[EMAIL PROTECTED]> CommitDate: Wed Apr 25 22:27:18 2007 -0700
[LIB]: 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 <[EMAIL PROTECTED]> Signed-off-by: David S. Miller <[EMAIL PROTECTED]> --- lib/div64.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/div64.c b/lib/div64.c index c3d7655..74f0c8c 100644 --- a/lib/div64.c +++ b/lib/div64.c @@ -61,20 +61,18 @@ EXPORT_SYMBOL(__div64_32); /* 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 git-commits-head" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html