diff options
Diffstat (limited to 'lib/reciprocal_div.c')
-rw-r--r-- | lib/reciprocal_div.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/reciprocal_div.c b/lib/reciprocal_div.c new file mode 100644 index 000000000000..6a3bd48fa2a0 --- /dev/null +++ b/lib/reciprocal_div.c | |||
@@ -0,0 +1,9 @@ | |||
1 | #include <asm/div64.h> | ||
2 | #include <linux/reciprocal_div.h> | ||
3 | |||
4 | u32 reciprocal_value(u32 k) | ||
5 | { | ||
6 | u64 val = (1LL << 32) + (k - 1); | ||
7 | do_div(val, k); | ||
8 | return (u32)val; | ||
9 | } | ||