[m-rev.] for review: Use a better algorithm for unwinding version_arrays.

Peter Wang novalazy at gmail.com
Tue Sep 9 15:38:04 AEST 2014


Hi Paul,

> So far I've left MercuryBitmap in bitmap.m and I'm trying to use it from
> version_array.m's C# code.  But I don't know how to reference it.  I've
> tried using the name "MercuryBitmap" and prefixing it with
> "bitmap.MercuryBitmap" (but "bitmap" isn't a namespace).

This compiles.  I didn't test it.

Peter

diff --git a/library/bitmap.m b/library/bitmap.m
index 7df812f..379b453 100644
--- a/library/bitmap.m
+++ b/library/bitmap.m
@@ -1572,7 +1572,7 @@ public class MercuryBitmap {
         byte b;
 
         b = elements[ByteIndexForBit(bit)];
-        b |= (byte) 1 << BitIndexWithinByte(bit);
+        b |= (byte) (1 << BitIndexWithinByte(bit));
         elements[ByteIndexForBit(bit)] = b;
     }
 
diff --git a/library/version_array.m b/library/version_array.m
index f6ef79b..3315cf9 100644
--- a/library/version_array.m
+++ b/library/version_array.m
@@ -1635,7 +1635,7 @@ public class ML_uva : ML_va {
         int                     I;
         object                  X;
         ML_uva                  cur;
-        MercuryBitmap           bitmap;
+        bitmap.MercuryBitmap    bitmap;
 
         if (this.is_latest()) {
             /* Shortcut */
@@ -1648,7 +1648,7 @@ public class ML_uva : ML_va {
         ** ensure that we never update an array slot twice.
         */
         cur = this;
-        bitmap = new MercuryBitmap(cur.size());
+        bitmap = new bitmap.MercuryBitmap(cur.size());
         while (!cur.is_latest()) {
             I = cur.index;
             X = cur.value;
@@ -1671,7 +1671,7 @@ public class ML_uva : ML_va {
         int                     I;
         object                  X;
         ML_uva                  cur;
-        MercuryBitmap           bitmap;
+        bitmap.MercuryBitmap    bitmap;
         object[]                array;
 
         if (is_latest()) {
@@ -1685,7 +1685,7 @@ public class ML_uva : ML_va {
         */
         cur = this;
         array = latest().array();
-        bitmap = new MercuryBitmap(array.length);
+        bitmap = new bitmap.MercuryBitmap(array.Length);
         while (!cur.is_latest()) {
             I = cur.index;
             X = cur.value;




More information about the reviews mailing list