repo.or.cz
/
lilypond.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
(staff_eligible): new function.
[lilypond.git]
/
lily
/
misc.cc
blob
adcf536ad26dc9130d215ec1f4d42f74d2e384f8
1
/*
2
misc.cc -- implement various stuff
3
4
source file of the GNU LilyPond music typesetter
5
6
(c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7
Jan Nieuwenhuizen <janneke@gnu.org>
8
*/
9
10
#include <math.h>
11
#include
"misc.hh"
12
13
/*
14
Return the 2-log, rounded down
15
*/
16
int
17
intlog2
(
int
d
)
18
{
19
assert
(
d
);
20
int
i
=
0
;
21
while
((
d
!=
1
))
22
{
23
d
/=
2
;
24
i
++;
25
}
26
27
assert
(! (
d
/
2
));
28
return
i
;
29
}
30
31
double
32
log_2
(
double
x
)
33
{
34
return
log
(
x
) /
log
(
2.0
);
35
}
36