mirror of https://github.com/encounter/SDL.git
Implement SDL_MostSignificantBitIndex32 using MSVC intrinsics
This commit is contained in:
parent
014f507c40
commit
91a831e2d0
|
@ -73,6 +73,12 @@ SDL_MostSignificantBitIndex32(Uint32 x)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 31 - _SDL_clz_watcom(x);
|
return 31 - _SDL_clz_watcom(x);
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
unsigned long index;
|
||||||
|
if (_BitScanReverse(&index, x)) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
#else
|
#else
|
||||||
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
|
/* Based off of Bit Twiddling Hacks by Sean Eron Anderson
|
||||||
* <seander@cs.stanford.edu>, released in the public domain.
|
* <seander@cs.stanford.edu>, released in the public domain.
|
||||||
|
|
Loading…
Reference in New Issue