X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmisc.cc;h=45a055f8a6bb4841b2028da33e4309683573dd7f;hb=a2991295b2c1fb36bec19de207161855ca3c1756;hp=8597a8ce14636f2d0f4b3a70c8430975e384ba99;hpb=720c52ff5a022a6e28189d8d1126d22443c313b2;p=lilypond.git diff --git a/lily/misc.cc b/lily/misc.cc index 8597a8ce14..45a055f8a6 100644 --- a/lily/misc.cc +++ b/lily/misc.cc @@ -3,29 +3,33 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2000 Han-Wen Nienhuys + (c) 1997--2001 Han-Wen Nienhuys Jan Nieuwenhuizen */ #include #include "misc.hh" +/* + Return the 2-log, rounded down + */ int -intlog2(int d) +intlog2 (int d) { assert (d); int i=0; - while (!(d&1)) + while ((d != 1)) { - d/= 2; - i++; + d/= 2; + i++; } - assert (!(d/2)); + + assert (! (d/2)); return i; } double -log_2(double x) +log_2 (double x) { return log (x) /log (2.0); } @@ -44,7 +48,7 @@ quantise_iv (Array positions, Real x) Real period = positions.top () - positions[0]; int n = int ((x - positions[0]) / period); - Real frac = (x - positions[0] ) - n * period; + Real frac = (x - positions[0]) - n * period; while (frac < 0) { @@ -53,7 +57,7 @@ quantise_iv (Array positions, Real x) } Real px = frac + positions[0]; - assert ( positions[0] <= px && px <= positions.top ()); + assert (positions[0] <= px && px <= positions.top ()); int i=0; for (; i < positions.size () - 1; i++) {