1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/kernel.h>
4 #include <linux/reciprocal_div.h>
5 #include <linux/export.h>
8 * For a description of the algorithm please have a look at
9 * include/linux/reciprocal_div.h
12 struct reciprocal_value reciprocal_value(u32 d)
14 struct reciprocal_value R;
19 m = ((1ULL << 32) * ((1ULL << l) - d));
24 R.sh2 = max(l - 1, 0);
28 EXPORT_SYMBOL(reciprocal_value);