SDL_Swap64LE(3)

πŸ’… SDL_Swap64LE(3) β€” SDL3 FUNCTIONS

okay bestie, welcome to the SDL_Swap64LE page from the SDL3 functions manual πŸ’– this one's a lil macro with big "i just fix your endianness and leave" energy, and honestly? iconic. let's get into it ✨


🌸 NAME 🌸

SDL_Swap64LE β€” swap a 64-bit value from littleendian to native byte order. that's it. that's the whole job. she's a specialist πŸŽ€


✨ SYNOPSIS ✨

#include <SDL3/SDL_endian.h>

#define SDL_Swap64LE(x) SwapOnlyIfNecessary(x)

so you pull in <SDL3/SDL_endian.h> and boom, the macro is right there waiting for you like a bestie holding your iced coffee 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

here's the tea, bestie: if this is running on a littleendian system, then x is returned unchanged. no swap, no drama, no nothing. she looked at your bytes, said "you're already correct", and walked away πŸ’…

and the lowkey genius part? this macro never references x more than once, which avoids side effects. so you can pass in your lil expression without worrying that it's gonna get evaluated twice behind your back. no cap, that's a real thing to care about 😌


πŸŽ€ MACRO PARAMETERS πŸŽ€

  • x β€” the value to swap, in littleendian byte order. hand her over and she'll do her thing ✨

πŸ’– RETURN VALUE πŸ’–

returns x in native byte order. same value, same vibes, just speaking your machine's native language now 🌈


πŸ”₯ THREAD SAFETY πŸ”₯

it is safe to call this macro from any thread. go wild. every thread gets a turn. no locking, no beef, no "wait your turn" energy β€” she's chill like that 😎


πŸ‘‘ AVAILABILITY πŸ‘‘

this macro has been available since SDL 3.2.0. so if you're on something older than that... bestie, upgrade. fr fr 🧚


reminder, queen: this is a macro, not a function, so the "call" is just you writing it in your code and the preprocessor doing the rest. the way that she handles all of it for you before the compiler even blinks? main character energy ⭐

Simple Directmedia Layer πŸ¦‹ SDL 3.4.18 β€” that's where this lil page comes from, and she's still serving looks. mwah, bye bestie, go swap some bytes πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from