simplify Watcom implementation of SDL_MostSignificantBitIndex32()

This commit is contained in:
Ozkan Sezer 2021-01-04 03:00:10 +03:00
parent ae18109a92
commit f414a43632
1 changed files with 3 additions and 4 deletions

View File

@ -48,10 +48,9 @@ extern "C" {
* \return Index of the most significant bit, or -1 if the value is 0.
*/
#if defined(__WATCOMC__) && defined(__386__)
extern _inline int _SDL_clz_watcom (Uint32);
#pragma aux _SDL_clz_watcom = \
extern _inline int _SDL_bsr_watcom (Uint32);
#pragma aux _SDL_bsr_watcom = \
"bsr eax, eax" \
"xor eax, 31" \
parm [eax] nomemory \
value [eax] \
modify exact [eax] nomemory;
@ -72,7 +71,7 @@ SDL_MostSignificantBitIndex32(Uint32 x)
if (x == 0) {
return -1;
}
return 31 - _SDL_clz_watcom(x);
return _SDL_bsr_watcom(x);
#elif defined(_MSC_VER)
unsigned long index;
if (_BitScanReverse(&index, x)) {