From f414a43632988b1a8d8f294a3876ad68154569ba Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <sezeroz@gmail.com>
Date: Mon, 4 Jan 2021 03:00:10 +0300
Subject: [PATCH] simplify Watcom implementation of
 SDL_MostSignificantBitIndex32()

---
 include/SDL_bits.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/SDL_bits.h b/include/SDL_bits.h
index f073abeb2..08b59eae3 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)) {