]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/misc.hh
*** empty log message ***
[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--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #ifndef MISC_HH
10 #define MISC_HH
11
12 #include <cstdlib>
13 using namespace std;
14
15 #include "array.hh"
16 #include "interval.hh"
17
18 double log_2 (double x);
19 int intlog2 (int d);
20
21 inline int
22 sign (int i)
23 {
24   if (i < 0)
25     return -1;
26   else if (i)
27     return 1;
28   else return 0;
29 }
30
31 Array<std::string> split_string (std::string s, char c);
32
33 inline Real
34 linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
35 {
36   return (x2 - x) / (x2 - x1) * y1
37     + (x - x1) / (x2 - x1) * y2;
38 }
39
40 Real directed_round (Real f, Direction d);
41
42 #endif
43