diff: runtime/mercury_float.h bug fix

Fergus Henderson fjh at cs.mu.oz.au
Wed Jun 25 14:53:48 AEST 1997


runtime/mercury_float.h:
	Fix a bug in the code for word_to_float() and float_to_word()
	for non-gcc compilers that prevented it from compiling.

Index: mercury_float.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_float.h,v
retrieving revision 1.4
diff -u -r1.4 mercury_float.h
--- mercury_float.h	1997/02/28 05:25:52	1.4
+++ mercury_float.h	1997/06/25 04:49:00
@@ -60,13 +60,16 @@
 
 #ifdef __GNUC__
 
+/* GNU C allows you to cast to a union type */
 #define float_to_word(f) (__extension__ ((union FloatWord)(Float)(f)).w)
 #define word_to_float(w) (__extension__ ((union FloatWord)(Word)(w)).f)
 
 #else /* not __GNUC__ */
 
-static Word float_to_word(Float f) { union FloatWord tmp = f; return tmp.w; }
-static Float word_to_float(Word w) { union FloatWord tmp = w; return tmp.f; }
+static Word float_to_word(Float f)
+	{ union FloatWord tmp; tmp.f = f; return tmp.w; }
+static Float word_to_float(Word w)
+	{ union FloatWord tmp; tmp.w = w; return tmp.f; }
 
 #endif /* not __GNUC__ */
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list