git.openpandora.org
/
pandora-kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
[PATCH] SLAB: use a multiply instead of a divide in obj_to_index()
[pandora-kernel.git]
/
lib
/
reciprocal_div.c
diff --git a/lib/reciprocal_div.c
b/lib/reciprocal_div.c
new file mode 100644
(file)
index 0000000..
6a3bd48
--- /dev/null
+++ b/
lib/reciprocal_div.c
@@ -0,0
+1,9
@@
+#include <asm/div64.h>
+#include <linux/reciprocal_div.h>
+
+u32 reciprocal_value(u32 k)
+{
+ u64 val = (1LL << 32) + (k - 1);
+ do_div(val, k);
+ return (u32)val;
+}