SDL 3.0
|
Go to the source code of this file.
Functions | |
SDL_FORCE_INLINE int | SDL_MostSignificantBitIndex32 (Uint32 x) |
SDL_FORCE_INLINE SDL_bool | SDL_HasExactlyOneBitSet32 (Uint32 x) |
SDL_FORCE_INLINE SDL_bool SDL_HasExactlyOneBitSet32 | ( | Uint32 | x | ) |
Determine if a unsigned 32-bit value has exactly one bit set.
If there are no bits set (x
is zero), or more than one bit set, this returns SDL_FALSE. If any one bit is exclusively set, this returns SDL_TRUE.
Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).
x | the 32-bit value to examine. |
x
, SDL_FALSE otherwise.\threadsafety It is safe to call this function from any thread.
Definition at line 138 of file SDL_bits.h.
SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32 | ( | Uint32 | x | ) |
Get the index of the most significant (set) bit in a 32-bit number.
Result is undefined when called with 0. This operation can also be stated as "count leading zeroes" and "log base 2".
Note that this is a forced-inline function in a header, and not a public API function available in the SDL library (which is to say, the code is embedded in the calling program and the linker and dynamic loader will not be able to find this function inside SDL itself).
x | the 32-bit value to examine. |
\threadsafety It is safe to call this function from any thread.
Definition at line 70 of file SDL_bits.h.