SDL_HasExactlyOneBitSet32(3)

πŸ’… SDL_HasExactlyOneBitSet32 πŸ’…

okay bestie, welcome to the SDL_HasExactlyOneBitSet32(3) page β€” yes that's a long name, yes it's a real one, and yes it's in the SDL3 functions lineup. it lives in <SDL3/SDL_bits.h> and it's about to become your new fave little bit-checker. let's get into it πŸŽ€


✨ NAME ✨

SDL_HasExactlyOneBitSet32 β€” figure out if an unsigned 32-bit value has exactly one bit set. one. not zero, not two, exactly one. that's the whole vibe check πŸ¦‹


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_bits.h>

SDL_FORCE_INLINE bool SDL_HasExactlyOneBitSet32(Uint32 x);

look at that signature. SDL_FORCE_INLINE, returns bool, takes a Uint32. chef's kiss πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

here's the tea, bestie: if there are no bits set (like, x is zero) or more than one bit set, this returns false. but if any one single bit is exclusively set β€” just the one, main character energy β€” it returns true. periodt ✨

lowkey important note: this is a forced-inline function in a header, NOT a public API function living inside the SDL library. translation? the code gets embedded directly in the calling program, and the linker and dynamic loader will not be able to find this function inside SDL itself. no cap, it's just not in there πŸ’€

🫢 FUNCTION PARAMETERS 🫢

  • x β€” the 32-bit value to examine. give it a look, that's all it does πŸ‘€

🌈 RETURN VALUE 🌈

Returns true if exactly one bit is set in x, false otherwise. simple as that, fr fr πŸ’œ


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread. go off, multithreaded queen πŸ‘‘


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older... bestie, upgrade πŸ™ˆ


and that's the page!! ty for reading, you're doing amazing, drink some water πŸ’–βœ¨πŸŒΈ

mwah πŸ’‹ β€” with love from the Simple Directmedia Layer, SDL 3.4.18, dated SDL_HasExactlyOneBitSet32(3). iykyk πŸŽ€

πŸ“¦ where this page comes from