forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Here is the current version of the 64 bit divide common code. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
- Loading branch information
Stephen Hemminger
authored and
David S. Miller
committed
Apr 26, 2007
1 parent
9d729f7
commit 3927f2e
Showing
13 changed files
with
60 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/* | ||
* Copyright (C) 2000, 2004 Maciej W. Rozycki | ||
* Copyright (C) 2003 Ralf Baechle | ||
* Copyright (C) 2003, 07 Ralf Baechle ([email protected]) | ||
* | ||
* This file is subject to the terms and conditions of the GNU General Public | ||
* License. See the file "COPYING" in the main directory of this archive | ||
|
@@ -9,6 +9,8 @@ | |
#ifndef _ASM_DIV64_H | ||
#define _ASM_DIV64_H | ||
|
||
#include <linux/types.h> | ||
|
||
#if (_MIPS_SZLONG == 32) | ||
|
||
#include <asm/compiler.h> | ||
|
@@ -78,6 +80,8 @@ | |
__quot = __quot << 32 | __low; \ | ||
(n) = __quot; \ | ||
__mod; }) | ||
|
||
extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
#endif /* (_MIPS_SZLONG == 32) */ | ||
|
||
#if (_MIPS_SZLONG == 64) | ||
|
@@ -101,6 +105,11 @@ | |
(n) = __quot; \ | ||
__mod; }) | ||
|
||
static inline uint64_t div64_64(uint64_t dividend, uint64_t divisor) | ||
{ | ||
return dividend / divisor; | ||
} | ||
|
||
#endif /* (_MIPS_SZLONG == 64) */ | ||
|
||
#endif /* _ASM_DIV64_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ | |
|
||
#include "asm/arch/div64.h" | ||
|
||
extern uint64_t div64_64(uint64_t dividend, uint64_t divisor); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,22 +24,6 @@ MODULE_AUTHOR("Harald Welte <[email protected]>"); | |
MODULE_DESCRIPTION("iptables match for matching number of pkts/bytes per connection"); | ||
MODULE_ALIAS("ipt_connbytes"); | ||
|
||
/* 64bit divisor, dividend and result. dynamic precision */ | ||
static u_int64_t div64_64(u_int64_t dividend, u_int64_t divisor) | ||
{ | ||
u_int32_t d = divisor; | ||
|
||
if (divisor > 0xffffffffULL) { | ||
unsigned int shift = fls(divisor >> 32); | ||
|
||
d = divisor >> shift; | ||
dividend >>= shift; | ||
} | ||
|
||
do_div(dividend, d); | ||
return dividend; | ||
} | ||
|
||
static int | ||
match(const struct sk_buff *skb, | ||
const struct net_device *in, | ||
|