SDL_SwapFloatLE(3)
π SDL_SwapFloatLE π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the group chat πΈ this one is called SDL_SwapFloatLE and it does exactly one adorable job: it swaps a floating point value from littleendian to native byte order. that's it. that's the whole personality. and honestly? iconic. β¨
π SYNOPSIS π
#include <SDL3/SDL_endian.h>
#define SDL_SwapFloatLE(x) SwapOnlyIfNecessary(x)
like. look at her. one macro, one job, no drama. π
π DESCRIPTION π
so here's the tea β β if this is running on a littleendian system, then x gets returned unchanged. no swapping, no nothing, because babes it's already in the right order π
and the best part: this macro never references x more than once, which means you avoid side effects. no sneaky double-evaluation jumpscare. it's giving β¨ responsible β¨. obsessed. π«Ά
π MACRO PARAMETERS π
xβ the value to swap, in littleendian byte order. that's the one, the only, the main character of this whole operation π
β RETURN VALUE β
Returns x in native byte order. so like, if you were on a bigendian system, you'd get the swapped version back; otherwise you get your baby back exactly how you left her π¦
π§ THREAD SAFETY π§
It is safe to call this macro from any thread. no locks, no stress, no "wait who's touching that" energy. go off, multithreaded queen π
π AVAILABILITY π
This macro is available since SDL 3.2.0. so if you're on anything older... bestie. upgrade. it's not a vibe. π
β οΈ tiny reminder: x is a floating point value, and it's coming in as littleendian. keep that straight and you're golden β¨
and that's the whole page, periodt π π written for Simple Directmedia Layer, and this lil manual is living in SDL 3.4.18 β so go forth, swap those floats, and slay ππ¦πΈ byeeee π«Άβ¨
π¦ 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