Browse Source

simplify Watcom implementation of SDL_MostSignificantBitIndex32()

Ozkan Sezer 4 years ago
parent
commit
f414a43632
1 changed files with 3 additions and 4 deletions
  1. 3 4
      include/SDL_bits.h

+ 3 - 4
include/SDL_bits.h

@@ -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)) {