Commit f414a43632988b1a8d8f294a3876ad68154569ba

Ozkan Sezer 2021-01-04T03:00:10

simplify Watcom implementation of SDL_MostSignificantBitIndex32()

diff --git a/include/SDL_bits.h b/include/SDL_bits.h
index f073abe..08b59ea 100644
--- a/include/SDL_bits.h
+++ b/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)) {