Skip to content

Commit

Permalink
effects: Fix PowerPC support (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fancy2209 authored Nov 9, 2024
1 parent 04926f5 commit 7e569cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
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]);
}
#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

0 comments on commit 7e569cc

Please sign in to comment.