diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-27 12:26:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-27 12:26:46 -0400 |
commit | 15c54033964a943de7b0763efd3bd0ede7326395 (patch) | |
tree | 840b292612d1b5396d5bab5bde537a9013db3ceb /lib/div64.c | |
parent | ad5da3cf39a5b11a198929be1f2644e17ecd767e (diff) | |
parent | 912a41a4ab935ce8c4308428ec13fc7f8b1f18f4 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (448 commits)
[IPV4] nl_fib_lookup: Initialise res.r before fib_res_put(&res)
[IPV6]: Fix thinko in ipv6_rthdr_rcv() changes.
[IPV4]: Add multipath cached to feature-removal-schedule.txt
[WIRELESS] cfg80211: Clarify locking comment.
[WIRELESS] cfg80211: Fix locking in wiphy_new.
[WEXT] net_device: Don't include wext bits if not required.
[WEXT]: Misc code cleanups.
[WEXT]: Reduce inline abuse.
[WEXT]: Move EXPORT_SYMBOL statements where they belong.
[WEXT]: Cleanup early ioctl call path.
[WEXT]: Remove options.
[WEXT]: Remove dead debug code.
[WEXT]: Clean up how wext is called.
[WEXT]: Move to net/wireless
[AFS]: Eliminate cmpxchg() usage in vlocation code.
[RXRPC]: Fix pointers passed to bitops.
[RXRPC]: Remove bogus atomic_* overrides.
[AFS]: Fix u64 printing in debug logging.
[AFS]: Add "directory write" support.
[AFS]: Implement the CB.InitCallBackState3 operation.
...
Diffstat (limited to 'lib/div64.c')
-rw-r--r-- | lib/div64.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/div64.c b/lib/div64.c index 365719f84832..b71cf93c529a 100644 --- a/lib/div64.c +++ b/lib/div64.c | |||
@@ -23,7 +23,7 @@ | |||
23 | /* Not needed on 64bit architectures */ | 23 | /* Not needed on 64bit architectures */ |
24 | #if BITS_PER_LONG == 32 | 24 | #if BITS_PER_LONG == 32 |
25 | 25 | ||
26 | uint32_t __div64_32(uint64_t *n, uint32_t base) | 26 | uint32_t __attribute__((weak)) __div64_32(uint64_t *n, uint32_t base) |
27 | { | 27 | { |
28 | uint64_t rem = *n; | 28 | uint64_t rem = *n; |
29 | uint64_t b = base; | 29 | uint64_t b = base; |
@@ -58,4 +58,24 @@ uint32_t __div64_32(uint64_t *n, uint32_t base) | |||
58 | 58 | ||
59 | EXPORT_SYMBOL(__div64_32); | 59 | EXPORT_SYMBOL(__div64_32); |
60 | 60 | ||
61 | /* 64bit divisor, dividend and result. dynamic precision */ | ||
62 | uint64_t div64_64(uint64_t dividend, uint64_t divisor) | ||
63 | { | ||
64 | uint32_t high, d; | ||
65 | |||
66 | high = divisor >> 32; | ||
67 | if (high) { | ||
68 | unsigned int shift = fls(high); | ||
69 | |||
70 | d = divisor >> shift; | ||
71 | dividend >>= shift; | ||
72 | } else | ||
73 | d = divisor; | ||
74 | |||
75 | do_div(dividend, d); | ||
76 | |||
77 | return dividend; | ||
78 | } | ||
79 | EXPORT_SYMBOL(div64_64); | ||
80 | |||
61 | #endif /* BITS_PER_LONG == 32 */ | 81 | #endif /* BITS_PER_LONG == 32 */ |