SDL_Swap64BE(3)
π SDL_Swap64BE π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_Swap64BE(3) β the little macro that fixes your endianness problems before they even start. no cap.
β¨ NAME β¨
SDL_Swap64BE β Swap a 64-bit value from bigendian to native byte order.
like, it takes your bigendian-flavored 64-bit number and hands it back in whatever byte order your machine actually speaks. endianness translation era π¦
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_endian.h>
#define SDL_Swap64BE(x) SwapOnlyIfNecessary(x)
she's a macro, not a function. #define girlie through and through. π
π DESCRIPTION π
so here's the vibe: if this is running on a bigendian system, then x is returned unchanged. literally untouched. because if you're already bigendian, why would we do extra work? that would be giving unnecessary labor energy and we don't do that here. π
and this is the part that's genuinely iconic: this macro never references x more than once, which avoids side effects. so if you pass something spicy into it, it's not getting evaluated twice behind your back. no sneaky double-evaluation, no surprises, no betrayal. π«Ά
π MACRO PARAMETERS π
xβ the value to swap, in bigendian byte order.
that's it. one parameter. she's low maintenance. πΈ
β RETURN VALUE β
Returns x in native byte order. that's the whole delivery. your value, but make it local. β¨
π₯ THREAD SAFETY π₯
It is safe to call this macro from any thread. any of them. all of them. thread girlies, you are so welcome here. π
π AVAILABILITY π
This macro is available since SDL 3.2.0. so if you're on an older SDL, bestie, this is your sign to upgrade. π
π SEE ALSO π
ngl, there's nothing else listed here, but if you're messing with byte order you probably already know what you're doing. iykyk. π
β οΈ tiny reminder: this macro never touches x more than once, so please don't assume it'll behave like a multi-reference macro. it won't. and that's a good thing. π
okay that's the whole page, bestie, you ate it, you understood it, and now you're an endianness main character. periodt. πβ¨ππ¦πΈ
this lil page came to you courtesy of Simple Directmedia Layer, running the SDL 3.4.18 era of the docs β mwah, sending you and your 64-bit values so much love. π«Άππ
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms