From 3300945660a82d316768a7bad2a97f88d546b950 Mon Sep 17 00:00:00 2001 From: gibbed Date: Thu, 28 May 2015 12:16:19 -0500 Subject: [PATCH] Fixed 8-bit and 16-bit xe::lzcnt. --- src/xenia/base/math.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xenia/base/math.h b/src/xenia/base/math.h index fb4b9bce6..f72efad6f 100644 --- a/src/xenia/base/math.h +++ b/src/xenia/base/math.h @@ -75,13 +75,13 @@ inline uint8_t lzcnt(uint8_t v) { DWORD index; DWORD mask = v; BOOLEAN is_nonzero = _BitScanReverse(&index, mask); - return static_cast(is_nonzero ? int8_t(index - 24) ^ 0x7 : 8); + return static_cast(is_nonzero ? int8_t(index) ^ 0x7 : 8); } inline uint8_t lzcnt(uint16_t v) { DWORD index; DWORD mask = v; BOOLEAN is_nonzero = _BitScanReverse(&index, mask); - return static_cast(is_nonzero ? int8_t(index - 16) ^ 0xF : 16); + return static_cast(is_nonzero ? int8_t(index) ^ 0xF : 16); } inline uint8_t lzcnt(uint32_t v) { DWORD index;