Wiki Page Content

Differences between revisions 2 and 3
Revision 2 as of 2013-08-07 23:36:44
Size: 1165
Editor: Sam Lantinga
Comment:
Revision 3 as of 2013-08-10 19:55:41
Size: 1190
Comment: Added header in example because function not included with SDL.h.
Deletions are marked like this. Additions are marked like this.
Line 30: Line 30:
#include "SDL_bits.h"

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.

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

#include "SDL_bits.h"

if (bitmask) {
    int index = SDL_MostSignificantBitIndex32(bitmask);
}

Remarks

You can add useful comments here


CategoryAPI, CategoryBits

None: SDL_MostSignificantBitIndex32 (last edited 2013-08-10 19:55:41 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit