GS 8.12 doesn't compile on MSVC 6.0

Alex Cherepanov <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Organization Coscript Software
Message-ID <[email protected]>
Split an expression in two because MSVC 6.00.8168.0 cannot compile it
in -O2 mode, enabled in GS 8.12 by default.

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
idict.c.diff (text/plain, 959 B)
Index: gs/src/idict.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/idict.c,v
retrieving revision 1.8
diff -b -u -r1.8 idict.c
--- gs/src/idict.c	3 Sep 2003 03:22:59 -0000	1.8
+++ gs/src/idict.c	12 Dec 2003 00:09:58 -0000
@@ -313,7 +313,7 @@
 	 * Make sure that equal reals and integers hash the same.
 	 */
 	{
-	    int expt;
+	    int expt, i;
 	    double mant = frexp(pkey->value.realval, &expt);
 	    /*
 	     * The value is mant * 2^expt, where 0.5 <= mant < 1,
@@ -321,9 +321,10 @@
 	     */
 
 	    if (expt < sizeof(long) * 8 || pkey->value.realval == min_long)
-		hash = (uint)(int)pkey->value.realval * 30503;
+		i = (int)pkey->value.realval;
 	    else
-		hash = (uint)(int)(mant * min_long) * 30503;
+		i = (int)(mant * min_long);  /* MSVC 6 cannot compile this        */
+	    hash = (uint)i * 30503;          /*   with -O2 as a single expression */
 	}
 	goto ih;
     case t_integer:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.