[m-rev.] diff: fix float64_bits_to_string/1 on MinGW64

Julien Fischer jfischer at opturion.com
Mon Mar 25 14:04:20 AEDT 2013


Fix float.float64_bits_string/1 on MinGW64.

library/float.m:
     Use the appropriate conversion specifier for
     MR_int_least64_t on MinGW64 in a spot.

runtime/mercury_conf_param.h:
     Define MR_MINGW64 on MinGW64 systems.

Julien.

diff --git a/library/float.m b/library/float.m
index f2896b0..f82b8ef 100644
--- a/library/float.m
+++ b/library/float.m
@@ -941,7 +941,11 @@ float.float_to_doc(X) = str(string.float_to_string(X)).
     char buf[64];

     u.f = (double) Flt;
-    sprintf(buf, ""%ld"", u.i);
+    #if defined(MR_MINGW64)
+        sprintf(buf, ""%lld"", u.i);
+    #else
+        sprintf(buf, ""%ld"", u.i);
+    #endif
     MR_make_aligned_string_copy(Str, buf);
 ").

diff --git a/runtime/mercury_conf_param.h b/runtime/mercury_conf_param.h
index 2ee6e85..b52c4b4 100644
--- a/runtime/mercury_conf_param.h
+++ b/runtime/mercury_conf_param.h
@@ -67,10 +67,17 @@
 ** MinGW specific.
 */

+/*
+** NOTE: __MINGW32__ is defined on both 32- and 64-bit MinGW.
+*/
 #if defined(__MINGW32__)
    #define MR_MINGW
 #endif

+#if defined(__MINGW64__)
+   #define MR_MINGW64
+#endif
+
 /*
 ** On x86_64-w64-mingw32, we need to define the macro __USE_MINGW_ANSI_STDIO
 ** in order to ensure that we get versions of printf, sprintf and friends



More information about the reviews mailing list