Replace SWAPDBL loop with memcpy, fixes MinGW Win64
authorEthan Lee <flibitijibibo@flibitijibibo.com>
Tue, 10 Nov 2020 19:17:45 -0500
changeset 1317 752092c8f284
parent 1316 27faf40fd955
child 1318 ff4eb6d9c9c2
Replace SWAPDBL loop with memcpy, fixes MinGW Win64
mojoshader.c
--- a/mojoshader.c	Fri Oct 23 23:35:41 2020 -0400
+++ b/mojoshader.c	Tue Nov 10 19:17:45 2020 -0500
@@ -2566,8 +2566,13 @@
             if (preshader->literals == NULL)
                 return;  // oh well.
             const double *litptr = (const double *) (clit.tokens + 2);
-            for (i = 0; i < lit_count; i++)
-                preshader->literals[i] = SWAPDBL(litptr[i]);
+            // !!! FIXME: This should be a SWAPDBL loop, but in addition to
+            // !!! FIXME:  never having an implementation, it turns out some
+            // !!! FIXME:  MinGW versions do not optimize this correctly, which
+            // !!! FIXME:  can cause random crashes on Win64. -flibit
+            //for (i = 0; i < lit_count; i++)
+            //    preshader->literals[i] = SWAPDBL(litptr[i]);
+            memcpy(preshader->literals, litptr, len);
         } // else if
     } // else