Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PowerPC #76

Merged
merged 9 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mojoshader_effects.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,12 @@ static void readvalue(const uint8 *base,
const uint32 siz = 4 * numobjects;
value->values = m(siz, d);
memcpy(value->values, valptr, siz);

#if MOJOSHADER_BIG_ENDIAN
int valI;
for (valI=0;valI < (value->value_count);valI++) {
value->valuesI[valI] = SWAP32(value->valuesI[valI]);
}
flibitijibibo marked this conversation as resolved.
Show resolved Hide resolved
#endif
for (i = 0; i < value->value_count; i++)
objects[value->valuesI[i]].type = (MOJOSHADER_symbolType) type;
} // else
Expand Down
4 changes: 2 additions & 2 deletions mojoshader_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ typedef Uint64 uint64;
#include <endian.h>
#define MOJOSHADER_BIG_ENDIAN (__BYTE_ORDER == __BIG_ENDIAN)
#else
#define MOJOSHADER_BIG_ENDIAN (defined(__POWERPC__))
#define MOJOSHADER_BIG_ENDIAN (defined(__POWERPC__) || defined(__powerpc__))
#endif
#endif /* MOJOSHADER_USE_SDL_STDLIB */

Expand Down Expand Up @@ -308,7 +308,7 @@ typedef uint64_t uint64;

// Byteswap magic...

#if ((defined __GNUC__) && (defined __POWERPC__))
#if ((defined __GNUC__) && ((defined __POWERPC__) || defined __powerpc__))
static inline uint32 SWAP32(uint32 x)
{
__asm__ __volatile__("lwbrx %0,0,%1" : "=r" (x) : "r" (&x));
Expand Down
Loading