Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 6346
b: refs/heads/master
c: 8ffde67
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Aug 29, 2005
1 parent fca963a commit 30ba70b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9d810fd2d28a9d672eca3136476af1a54a380bb2
refs/heads/master: 8ffde671730df0b392ca478643b88ef7153244c0
24 changes: 10 additions & 14 deletions trunk/net/ipv4/netfilter/ipt_connbytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,19 @@ MODULE_AUTHOR("Harald Welte <laforge@netfilter.org>");
MODULE_DESCRIPTION("iptables match for matching number of pkts/bytes per connection");

/* 64bit divisor, dividend and result. dynamic precision */
static u_int64_t div64_64(u_int64_t divisor, u_int64_t dividend)
static u_int64_t div64_64(u_int64_t dividend, u_int64_t divisor)
{
u_int64_t result = divisor;

if (dividend > 0xffffffff) {
int first_bit = find_first_bit((unsigned long *) &dividend, sizeof(dividend));
/* calculate number of bits to shift. shift exactly enough
* bits to make dividend fit in 32bits. */
int num_shift = (64 - 32 - first_bit);
/* first bit has to be < 32, since dividend was > 0xffffffff */
result = result >> num_shift;
dividend = dividend >> num_shift;
}
u_int32_t d = divisor;

if (divisor > 0xffffffffULL) {
unsigned int shift = fls(divisor >> 32);

do_div(divisor, dividend);
d = divisor >> shift;
dividend >>= shift;
}

return divisor;
do_div(dividend, d);
return dividend;
}

static int
Expand Down

0 comments on commit 30ba70b

Please sign in to comment.