SDL_SwapLE32 for 64 bit CPUs?

Hi All,

Is there a SDL_SwapLE32 equivalent for 64 bit processors? I have a user who
says that blobwars doesn’t work correctly on his machine, so I’m guessing
that the SDL_SwapLE32 isn’t working correctly.

oh… the game is crashing just after it attempts to set itself up for
indexing of my pak file (which uses longs in its meta data)

Stevie :slight_smile:

Stephen Sweeney wrote:

Hi All,

Is there a SDL_SwapLE32 equivalent for 64 bit processors? I have a user who
says that blobwars doesn’t work correctly on his machine, so I’m guessing
that the SDL_SwapLE32 isn’t working correctly.

Yes, there is SDL_SwapLE64.

oh… the game is crashing just after it attempts to set itself up for
indexing of my pak file (which uses longs in its meta data)

There’s more about this :

  • on x86, int is 32 bits, long is 32 bits and long long is 64 bits (this
    is called ILP32).
  • on most sane 64 bits architectures (x86_64, ia64, powerpc…) int is
    32 bits, long is 64 bits and long long is 64 bits too (that’s usually
    called I32LP64 or simply LP64 for “long pointer 64”).
  • the people at microsoft decided to do differently, and use LLP64 on 64
    bit windows : ints and longs are 32 bits, and long longs and pointers
    are 64 bits.

So, using “long” is not portabe. Thus, you need to use a portable type
in your code (hint : use SDL’s Uint64/Sint64 if you need the 64 bits).

Stephane