aboutsummaryrefslogtreecommitdiff
path: root/lib/int_sqrt.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2019-04-19 12:37:22 +0100
committerMark Brown <broonie@kernel.org>2019-04-19 12:37:22 +0100
commit8fd8f8d65bf56aaa80c7ae5eaf26afd586139683 (patch)
tree8f9fd52a208936407fcba87b85c4445b38ee5eaa /lib/int_sqrt.c
parentbf72d1505bc41ffd6b8d052e6da2f8fc535ed45a (diff)
parent58b454ebf81e5ae9391957d99cf89566d9eec1b1 (diff)
Merge tag 'v4.14.112' into linux-linaro-lsk-v4.14linux-linaro-lsk-v4.14
This is the 4.14.112 stable release
Diffstat (limited to 'lib/int_sqrt.c')
-rw-r--r--lib/int_sqrt.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/int_sqrt.c b/lib/int_sqrt.c
index 036c96781ea8..67bb300b5b46 100644
--- a/lib/int_sqrt.c
+++ b/lib/int_sqrt.c
@@ -8,6 +8,7 @@
#include <linux/kernel.h>
#include <linux/export.h>
+#include <linux/bitops.h>
/**
* int_sqrt - rough approximation to sqrt
@@ -22,10 +23,7 @@ unsigned long int_sqrt(unsigned long x)
if (x <= 1)
return x;
- m = 1UL << (BITS_PER_LONG - 2);
- while (m > x)
- m >>= 2;
-
+ m = 1UL << (__fls(x) & ~1UL);
while (m != 0) {
b = y + m;
y >>= 1;