diff --git a/Include/AuroraUtils.hpp b/Include/AuroraUtils.hpp index b443785f..68836af7 100644 --- a/Include/AuroraUtils.hpp +++ b/Include/AuroraUtils.hpp @@ -691,17 +691,15 @@ static auline bool AuBitScanForward(AuUInt8 &index, T value) success = false; index = 0; - if (value == 0) - { - return false; - } - #if defined(AURORA_COMPILER_MSVC) if constexpr (sizeof(T) == sizeof(AuUInt64)) #if defined(AURORA_IS_32BIT) if (!_BitScanForward(&ret, static_cast(value & 0xffffffff))) { - _BitScanForward(&ret, static_cast((value >> 32) & 0xffffffff)); + if (!_BitScanForward(&ret, static_cast((value >> 32) & 0xffffffff))) + { + return false; + } ret += 32; } #else @@ -709,6 +707,11 @@ static auline bool AuBitScanForward(AuUInt8 &index, T value) #endif else success = _BitScanForward(&ret, static_cast(value)); #elif defined(AURORA_COMPILER_GCC) || defined(AURORA_COMPILER_CLANG) + if (value == 0) + { + return false; + } + if constexpr (sizeof(T) == sizeof(AuUInt64)) #if defined(AURORA_IS_32BIT) auto lower = static_cast(value & 0xffffffff));