[m-rev.] for review: fix pickle.m warning

Zoltan Somogyi zs at csse.unimelb.edu.au
Wed Nov 19 17:32:11 AEDT 2008


There don't seem to be any pickle tests in the test suite. In absence
of such tests, can someone from MC please try this out?

Zoltan.

compiler/pickle.m:
	Avoid warnings from the C compiler on 32-bit platforms.

cvs diff: Diffing .
Index: pickle.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pickle.m,v
retrieving revision 1.1
diff -u -b -r1.1 pickle.m
--- pickle.m	25 Jul 2008 00:47:57 -0000	1.1
+++ pickle.m	19 Nov 2008 06:22:34 -0000
@@ -429,11 +429,15 @@
     [will_not_call_mercury, promise_pure, thread_safe],
 "
     if (sizeof(MR_Float) == sizeof(float)) {
-        MR_uint_least32_t *p = (MR_uint_least32_t *) &Flt;
+        MR_uint_least32_t   *p;
+
+        p = (MR_uint_least32_t *) &Flt;
         A = *p;
         B = 0;
     } else {
-        MR_uint_least64_t *p = (MR_uint_least64_t *) &Flt;
+        MR_uint_least64_t   *p;
+
+        p = (MR_uint_least64_t *) &Flt;
         A = (*p >> 32) & 0xffffffff;
         B = (*p >>  0) & 0xffffffff;
     }
@@ -454,12 +458,18 @@
     [will_not_call_mercury, promise_pure, thread_safe],
 "
     if (sizeof(MR_Float) == sizeof(float)) {
-        MR_Float *p = (MR_Float *) &A;
+        MR_Float    *p;
+
+        p = (MR_Float *) &A;
         Flt = *p;
         (void) B;
     } else {
-        MR_uint_least64_t tmp = (A << 32) | (B & 0xffffffff);
-        MR_Float *p = (MR_Float *) &tmp;
+        MR_uint_least64_t   tmp;
+        MR_Float            *p;
+
+        tmp = (((MR_uint_least64_t) A) << 32) |
+            (((MR_uint_least64_t) B) & 0xffffffff);
+        p = (MR_Float *) &tmp;
         Flt = *p;
     }
 ").
cvs diff: Diffing notes
--------------------------------------------------------------------------
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