From 69e9d9767a0bd1d324f8271d820220cd4e87db7d Mon Sep 17 00:00:00 2001 From: scribam Date: Sat, 31 Aug 2019 12:16:42 +0200 Subject: [PATCH] windows: Add fallback for _BitScanForward64 on 32-bits system --- core/log/BitSet.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/log/BitSet.h b/core/log/BitSet.h index 4bf909df8..7fc0246f8 100644 --- a/core/log/BitSet.h +++ b/core/log/BitSet.h @@ -45,7 +45,13 @@ inline int LeastSignificantSetBit(u32 val) inline int LeastSignificantSetBit(u64 val) { unsigned long index; +#ifdef _WIN64 _BitScanForward64(&index, val); +#else + if (!_BitScanForward(&index, (u32)val) && _BitScanForward(&index, (u32)(val >> 32))) { + index += 32; + } +#endif return (int)index; } #else