mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 09:02:06 +00:00
[NET]: div64_64 consolidate (rev3)
Here is the current version of the 64 bit divide common code. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9d729f72dc
commit
3927f2e8f9
13 changed files with 60 additions and 63 deletions
|
@ -73,27 +73,6 @@ static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked)
|
|||
yeah->pkts_acked = pkts_acked;
|
||||
}
|
||||
|
||||
/* 64bit divisor, dividend and result. dynamic precision */
|
||||
static inline u64 div64_64(u64 dividend, u64 divisor)
|
||||
{
|
||||
u32 d = divisor;
|
||||
|
||||
if (divisor > 0xffffffffULL) {
|
||||
unsigned int shift = fls(divisor >> 32);
|
||||
|
||||
d = divisor >> shift;
|
||||
dividend >>= shift;
|
||||
}
|
||||
|
||||
/* avoid 64 bit division if possible */
|
||||
if (dividend >> 32)
|
||||
do_div(dividend, d);
|
||||
else
|
||||
dividend = (u32) dividend / d;
|
||||
|
||||
return dividend;
|
||||
}
|
||||
|
||||
static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack,
|
||||
u32 seq_rtt, u32 in_flight, int flag)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue