summaryrefslogtreecommitdiff
path: root/lib/int_sqrt.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/int_sqrt.c')
-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 1ef4cc344977..1afb545a37c5 100644
--- a/lib/int_sqrt.c
+++ b/lib/int_sqrt.c
@@ -22,6 +22,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;