(staff_eligible): new function.
[lilypond.git] / lily / misc.cc
blobadcf536ad26dc9130d215ec1f4d42f74d2e384f8
1 /*
2 misc.cc -- implement various stuff
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
8 */
10 #include <math.h>
11 #include "misc.hh"
14 Return the 2-log, rounded down
16 int
17 intlog2 (int d)
19 assert (d);
20 int i=0;
21 while ((d != 1))
23 d /= 2;
24 i++;
27 assert (! (d/2));
28 return i;
31 double
32 log_2 (double x)
34 return log (x) /log (2.0);