]> git.donarmstrong.com Git - lilypond.git/blob - lily/misc.cc
*** empty log message ***
[lilypond.git] / lily / misc.cc
1 /*
2   misc.cc -- implement various stuff
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7     Jan Nieuwenhuizen <janneke@gnu.org>
8 */
9
10 #include "misc.hh"
11
12 #include <math.h>
13
14 /*
15   Return the 2-log, rounded down 
16  */
17 int
18 intlog2 (int d)
19 {
20   assert (d);
21   int i=0;
22   while ((d != 1)) 
23     {
24       d /= 2;
25       i++;
26     }
27   
28   assert (! (d/2));
29   return i;
30 }
31
32 double
33 log_2 (double x)
34 {
35   return log (x)  /log (2.0);
36 }
37
38