SDL_AUDIO_ISLITTLEENDIAN(3)

πŸ’– SDL_AUDIO_ISLITTLEENDIAN πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where today's main character is SDL_AUDIO_ISLITTLEENDIAN(3) β€” yes the whole thing is SCREAMING, that's just how macros are, they're loud and they're proud 🫢


✨ NAME ✨

SDL_AUDIO_ISLITTLEENDIAN β€” Determine if an SDL_AudioFormat represents littleendian data.

like. that's the whole vibe check. is this audio format littleendian or not. boom. πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_audio.h>

#define SDL_AUDIO_ISLITTLEENDIAN(x)  (!SDL_AUDIO_ISBIGENDIAN(x))

ngl the way this macro is literally just the opposite of the bigendian check? iconic. it said "why do the work myself when I can just flip a boolean" and honestly? valid. πŸ‘‘


✨ DESCRIPTION ✨

So here's the tea, bestie πŸ“ β€” this macro tells you whether a given SDL_AudioFormat value is littleendian. It does that by asking SDL_AUDIO_ISBIGENDIAN(x) and then going "not that."

For example, SDL_AUDIO_ISLITTLEENDIAN(SDL_AUDIO_S16BE) returns 0.

and yeah, that 0 is not a typo, not a glitch, not a bad take β€” that format is BE as in BIG endian, so it is very much NOT littleendian, so you get a big fat zero. the macro is correct and it is thriving. ✨


✨ MACRO PARAMETERS ✨

  • x β€” an SDL_AudioFormat value. that's it, that's the whole input. one (1) value. no notes. πŸŽ€

✨ RETURN VALUE ✨

  • Returns non-zero if format is littleendian 🌸
  • Returns zero otherwise

so like, if it's truthy, she's littleendian. if it's 0, she is not. classic binary situation, no in-between, no "it's complicated". periodt. πŸ’…


✨ THREAD SAFETY ✨

It is safe to call this macro from any thread. 🧚

literally any thread. go wild. spawn a thousand of them. she does not care, she is not scared, she has no state to fight over. main character energy that is also somehow completely chill. πŸ¦‹


✨ AVAILABILITY ✨

This macro is available since SDL 3.2.0. so if you're on something older than that, bestie, you are simply not invited to this party 😭 upgrade time fr fr.


🫢 friendly reminder: this is a macro, not a function. there's no symbol to link against, no function pointer to take, no ABI drama. it just expands. don't be weird about it. πŸ’€

and that's the whole page, bestie!! πŸ’–βœ¨πŸŒΈ

this little love letter to endianness comes to you straight from Simple Directmedia Layer, and the version tag on the tin is SDL 3.4.18 β€” SDL_AUDIO_ISLITTLEENDIAN(3), signing off, mwah πŸ’…πŸŽ€πŸŒˆ

πŸ“¦ where this page comes from