From: fred Date: Tue, 26 Mar 2002 23:21:58 +0000 (+0000) Subject: lilypond-1.3.52 X-Git-Tag: release/1.5.59~1631 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4818572c4f380d35993743727fa89d148261f5ac;p=lilypond.git lilypond-1.3.52 --- diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 38a409cb87..9d030b8e86 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -368,6 +368,23 @@ ly_number2string (SCM s) return gh_str02scm (str); } +// #define TEST_GC + +#ifdef TEST_GC +#include + +static void * +greet_sweep (void *dummy1, void *dummy2, void *dummy3) +{ + fprintf(stderr, "entering sweep\n"); +} + +static void * +wave_sweep_goodbye (void *dummy1, void *dummy2, void *dummy3) +{ + fprintf(stderr, "leaving sweep\n"); +} +#endif static void init_functions () @@ -376,6 +393,13 @@ init_functions () scm_make_gsubr ("ly-gulp-file", 1,0, 0, (SCM(*)(...))ly_gulp_file); scm_make_gsubr ("dir?", 1,0, 0, (SCM(*)(...))ly_isdir_p); scm_make_gsubr ("ly-number->string", 1, 0,0, (SCM(*)(...)) ly_number2string); + + +#ifdef TEST_GC + scm_c_hook_add (&scm_before_mark_c_hook, greet_sweep, 0, 0); + scm_c_hook_add (&scm_before_sweep_c_hook, wave_sweep_goodbye, 0, 0); +#endif + } ADD_SCM_INIT_FUNC(funcs, init_functions); diff --git a/lily/misc.cc b/lily/misc.cc index 8597a8ce14..9ff95f2a02 100644 --- a/lily/misc.cc +++ b/lily/misc.cc @@ -10,16 +10,20 @@ #include #include "misc.hh" +/* + Return the 2-log, rounded down + */ int intlog2(int d) { assert (d); int i=0; - while (!(d&1)) + while ((d != 1)) { - d/= 2; - i++; + d/= 2; + i++; } + assert (!(d/2)); return i; }