lilypond-0.1.47
[lilypond.git] / lily / misc.cc
blobd150d557926ecc4ecd7293a03659cd7c9666d81f
1 /*
2 misc.cc -- implement various stuff
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include <math.h>
11 #include "item.hh"
12 #include "misc.hh"
13 #include "moment.hh"
15 int
16 intlog2(int d) {
17 int i=0;
18 while (!(d&1))
20 d/= 2;
21 i++;
23 assert (!(d/2));
24 return i;
27 double
28 log_2(double x) {
29 return log (x) /log (2.0);
32 #if 1
33 Interval
34 itemlist_width (const Array<Item*> &its)
36 Interval iv ;
37 iv.set_empty();
39 for (int j =0; j < its.size(); j++)
41 iv.unite (its[j]->width());
44 return iv;
47 #endif