|
@@ -8,6 +8,7 @@
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/kernel.h>
|
|
|
#include <linux/export.h>
|
|
#include <linux/export.h>
|
|
|
|
|
+#include <linux/bitops.h>
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* int_sqrt - rough approximation to sqrt
|
|
* int_sqrt - rough approximation to sqrt
|
|
@@ -22,10 +23,7 @@ unsigned long int_sqrt(unsigned long x)
|
|
|
if (x <= 1)
|
|
if (x <= 1)
|
|
|
return x;
|
|
return x;
|
|
|
|
|
|
|
|
- m = 1UL << (BITS_PER_LONG - 2);
|
|
|
|
|
- while (m > x)
|
|
|
|
|
- m >>= 2;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ m = 1UL << (__fls(x) & ~1UL);
|
|
|
while (m != 0) {
|
|
while (m != 0) {
|
|
|
b = y + m;
|
|
b = y + m;
|
|
|
y >>= 1;
|
|
y >>= 1;
|