SDL_Swap64(3)

πŸ’… SDL_Swap64 β€” the glow-up for your bytes

okay bestie, welcome to SDL_Swap64(3) from the SDL3 FUNCTIONS crew ✨ this one lives in <SDL3/SDL_endian.h> and it's here to flip your 64-bit numbers around, endian-style πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_endian.h>

SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x);

✨ DESCRIPTION ✨

so like, this function will always byte-swap the value. every single time. no vibe check first, no "hmm is this already in the native byteorder of the system?" β€” it does not care, it swaps regardless πŸ’€

because of that, in most cases you should lowkey be using SDL_Swap64LE or SDL_Swap64BE instead. those are the ones that know what's up. this one is the raw, unfiltered, always-swapping version πŸ™ˆ

also important: this is a forced-inline function in a header, not a public API function chillin' inside the SDL library itself. translation for the group chat: the code gets embedded directly into the calling program, so the linker and the dynamic loader will not be able to find this function inside SDL itself. it's giving "not me, I'm in your binary now" πŸ‘‘


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • x β€” the value to byte-swap. that's it, that's the whole parameter, she's simple and she knows what she wants πŸ’–

πŸ’– RETURN VALUE πŸ’–

Returns x, with its bytes in the opposite endian order. so same number, same name, completely flipped byte order. it's giving main character transformation arc πŸ”₯


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. no cap, every thread, all at once, go off πŸ‘‘


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0.


ngl, if you take one thing from this page: reach for SDL_Swap64LE or SDL_Swap64BE first unless you actually want the unconditional swap. SDL_Swap64 will not ask questions, she will just swap πŸ’…

and that's the whole page, bestie! 🌈 this absolute icon of a manual page comes courtesy of Simple Directmedia Layer, version SDL 3.4.18, dated SDL_Swap64(3) β€” mwah, love that for us πŸ«ΆπŸ’–

πŸ“¦ where this page comes from