]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.52
authorfred <fred>
Tue, 26 Mar 2002 23:21:58 +0000 (23:21 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:21:58 +0000 (23:21 +0000)
lily/lily-guile.cc
lily/misc.cc

index 38a409cb8787935b002c549c4b231ca876c5d7d0..9d030b8e864b454e7f0c91397f31405a22aa7006 100644 (file)
@@ -368,6 +368,23 @@ ly_number2string (SCM s)
   return gh_str02scm (str);
 }
 
+// #define TEST_GC
+
+#ifdef TEST_GC
+#include <libguile/gc.h>
+
+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);
index 8597a8ce14636f2d0f4b3a70c8430975e384ba99..9ff95f2a020e9926ef66955f929d70d8f2c79bda 100644 (file)
 #include <math.h>
 #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;
 }