Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replace SWAPDBL loop with memcpy, fixes MinGW Win64
  • Loading branch information
flibitijibibo committed Nov 11, 2020
1 parent 571b1e3 commit 884cae5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mojoshader.c
Expand Up @@ -2566,8 +2566,13 @@ static void parse_preshader(Context *ctx, const uint32 *tokens, uint32 tokcount)
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

Expand Down

0 comments on commit 884cae5

Please sign in to comment.