-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Milestone
Description
The current doc page about SDL_MostSignificantBitIndex32 is like so:
Lines 48 to 67 in ad91384
| /** | |
| * 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). | |
| * | |
| * \param x the 32-bit value to examine. | |
| * \returns the index of the most significant bit, or -1 if the value is 0. | |
| * | |
| * \threadsafety It is safe to call this function from any thread. | |
| * | |
| * \since This function is available since SDL 3.2.0. | |
| */ | |
| SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) | |
| { |
in one place it says:
Result is undefined when called with 0
but in another:
returns [...] -1 if the value is 0.
so those notes are contradictory to one another. I quickly looked into all pp branches and each one seems to be handling this case with return -1, so the claim about it causing UB looks like some leftover (?)
Mind clarifying this one?
Reactions are currently unavailable