From 0b3cdf2aaadce709cbbff3d83259291bff6ad924 Mon Sep 17 00:00:00 2001 From: gibbed Date: Sun, 9 Feb 2020 16:36:20 -0600 Subject: [PATCH] [Base] Fix non-Windows bit_scan_forward. --- 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 02cb47074..c33e27019 100644 --- a/src/xenia/base/math.h +++ b/src/xenia/base/math.h @@ -233,12 +233,12 @@ inline bool bit_scan_forward(uint64_t v, uint32_t* out_first_set_index) { #else inline bool bit_scan_forward(uint32_t v, uint32_t* out_first_set_index) { int i = ffs(v); - *out_first_set_index = i; + *out_first_set_index = i - 1; return i != 0; } inline bool bit_scan_forward(uint64_t v, uint32_t* out_first_set_index) { int i = ffsll(v); - *out_first_set_index = i; + *out_first_set_index = i - 1; return i != 0; } #endif // XE_PLATFORM_WIN32