repo.or.cz
/
minix3.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
custom message type for VM_INFO
[minix3.git]
/
lib
/
libsys
/
sqrt_approx.c
blob
07eeaec4f9517cbfea1284ff1fe2ac6c6c0f5012
1
#include <minix/sysutil.h>
2
3
u32_t
sqrt_approx
(
u32_t in
)
4
{
5
int
b
,
v
=
0
;
6
for
(
b
= (
sizeof
(
in
)*
8
)/
2
-
1
;
b
>=
0
;
b
--) {
7
u32_t n
=
v
| (
1UL
<<
b
);
8
if
(
n
*
n
<=
in
)
9
v
=
n
;
10
}
11
12
return
v
;
13
}
14