]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/misc.hh
* flower
[lilypond.git] / lily / include / misc.hh
1 /*
2   misc.hh -- declare miscellaneous functions.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef MISC_HH
10 #define MISC_HH
11
12 #include <cstdlib>
13
14 #include "array.hh"
15 #include "interval.hh"
16
17 double log_2 (double x);
18 int intlog2 (int d);
19
20 inline int
21 sign (int i)
22 {
23   if (i < 0)
24     return -1;
25   else if (i)
26     return 1;
27   else return 0;
28 }
29
30 Array<String> split_string (String s, char c);
31
32 inline Real
33 linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
34 {
35   return (x2 - x) / (x2 - x1) * y1
36     + (x - x1) / (x2 - x1) * y2;
37 }
38
39 #endif
40