summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/int_sqrt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/int_sqrt.c b/lib/int_sqrt.c
index db0b5aa071fc..036c96781ea8 100644
--- a/lib/int_sqrt.c
+++ b/lib/int_sqrt.c
@@ -23,6 +23,9 @@ unsigned long int_sqrt(unsigned long x)
return x;
m = 1UL << (BITS_PER_LONG - 2);
+ while (m > x)
+ m >>= 2;
+
while (m != 0) {
b = y + m;
y >>= 1;