|
SDL3pp
A slim C++ wrapper for SDL3
|
Functions for fiddling with bits and bitmasks. More...
Functions | |
| int | SDL::MostSignificantBitIndex32 (Uint32 x) |
| Get the index of the most significant (set) bit in a 32-bit number. | |
| bool | SDL::HasExactlyOneBitSet32 (Uint32 x) |
| Determine if a unsigned 32-bit value has exactly one bit set. | |
Functions for fiddling with bits and bitmasks.
|
inline |
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 false. If any one bit is exclusively set, this returns 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. |
|
inline |
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. |