Eric Dumazet | 6a2d7a9 | 2006-12-13 00:34:27 -0800 | [diff] [blame] | 1 | #include <asm/div64.h> |
2 | #include <linux/reciprocal_div.h> | ||||
Eric Dumazet | 8af2a21 | 2011-12-08 06:06:03 +0000 | [diff] [blame] | 3 | #include <linux/export.h> |
Eric Dumazet | 6a2d7a9 | 2006-12-13 00:34:27 -0800 | [diff] [blame] | 4 | |
5 | u32 reciprocal_value(u32 k) | ||||
6 | { | ||||
7 | u64 val = (1LL << 32) + (k - 1); | ||||
8 | do_div(val, k); | ||||
9 | return (u32)val; | ||||
10 | } | ||||
Eric Dumazet | 8af2a21 | 2011-12-08 06:06:03 +0000 | [diff] [blame] | 11 | EXPORT_SYMBOL(reciprocal_value); |