[m-rev.] diff: fix bitmap comparison

Simon Taylor staylr at gmail.com
Sat Feb 17 12:08:01 AEDT 2007


Estimated hours taken: 0.25
Branches: main

runtime/mercury_bitmap.h:
        Fix comparison of bitmaps: it was calling memcmp on the
	entire bitmap, not just the elements.

Index: mercury_bitmap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_bitmap.h,v
retrieving revision 1.2
diff -u -u -r1.2 mercury_bitmap.h
--- mercury_bitmap.h    13 Feb 2007 03:49:15 -0000      1.2
+++ mercury_bitmap.h    17 Feb 2007 00:55:22 -0000
@@ -47,7 +47,7 @@
         } else if (cmp_size1 > cmp_size2) {                             \
             (res) = 1;                                                  \
         } else {                                                        \
-            (res) = memcmp(cmp_b1, cmp_b2,                              \
+            (res) = memcmp(cmp_b1->elements, cmp_b2->elements,          \
                         MR_bitmap_length_in_bytes(cmp_size1));          \
         }                                                               \
     } while (0)
@@ -114,7 +114,7 @@
 #ifdef __GNUC__
 #define MR_hash_bitmap(b)                                               \
     ({                                                                  \
-         MR_Integer hash_bitmap_result;                                 \
+        MR_Integer hash_bitmap_result;                                  \
         MR_CHECK_EXPR_TYPE(b, MR_ConstBitmapPtr);                       \
         MR_do_hash_bitmap(hash_bitmap_result, (b));                     \
         hash_bitmap_result;                  
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list