The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Confused about SDL_SwapLE16
hondres


Joined: 03 Nov 2015
Posts: 2
I'm trying to make the open-source game engine Godot compatible with SDL2 gamepad mappings. I'm a bit confused about the way joystick GUIDs are generated.
For example this line:

Code:
*(guid16++) = SDL_SwapLE16(inpid.vendor);


As I understand it, SDL_SwapLE should only byteswap the value on big-endian systems, and the macro does indeed look fine to me.
However when I tried to implement it (on a LE machine), I had to explicitly byteswap those values in order to get the same GUIDs sdl does.
Does anyone have some information on what's going on here? Wink