This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: New sparse bitmap implementation



On Mar 20, 2007, at 9:24 AM, Seongbae Park wrote:


+void
+dump_ebitmap (FILE *file, ebitmap bmap)
...
+  for (pos = 30, i = 0; i < size; i++)
+    if (ebitmap_bit_p (bmap, i))
+      {
+	if (pos > 70)
+	  {
+	    fprintf (file, "\n  ");
+	    pos = 0;
+	  }
+
+	fprintf (file, "%d ", i);
+	pos += 2 + (i >= 10) + (i >= 100) + (i >= 1000);
+      }

Ha. This code looks fun :)
Why don't you just use %4d and print the fixed number of elements
in each line ? It might even be easier to read as well :)

Or just:


pos += fprintf (file, "%d ", i);

-Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]