|
⇤ ← Revision 1 as of 2013-02-13 17:41:35
Size: 1247
Comment: Initial documents for MSBIndex32
|
Size: 1165
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| ||<tablewidth="100%" style="color: #FF0000;" :> DRAFT|| | |
| Line 18: | Line 17: |
| Sint8 SDL_MostSignificantBitIndex32(Uint32 x) | int SDL_MostSignificantBitIndex32(Uint32 x) |
| Line 27: | Line 26: |
| Returns the index of the most significant bit if x is > 0, otherwise output is undefined. | Returns the index of the most significant bit of x, or -1 if x is 0. |
| Line 32: | Line 31: |
| Sint8 index = SDL_MostSignificantBitIndex32(bitmask); | int index = SDL_MostSignificantBitIndex32(bitmask); |
SDL_MostSignificantBitIndex32
Use this function to get the index of the most significant (set) bit in a 32-bit number. This is also the same as the base 2 logarithm of the number.
Contents
Syntax
int SDL_MostSignificantBitIndex32(Uint32 x)
Function Parameters
x |
the number to find the MSB of |
Return Value
Returns the index of the most significant bit of x, or -1 if x is 0.
Code Examples
if (bitmask) {
int index = SDL_MostSignificantBitIndex32(bitmask);
}
Remarks
You can add useful comments here
