From e6f1888391125302f7c8292799763d084241698b Mon Sep 17 00:00:00 2001 From: aikiriao Date: Fri, 21 Jun 2024 21:40:32 +0900 Subject: [PATCH] use intrinsics function. --- libs/srla_internal/include/srla_utility.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/srla_internal/include/srla_utility.h b/libs/srla_internal/include/srla_utility.h index 98ce205..e64328c 100644 --- a/libs/srla_internal/include/srla_utility.h +++ b/libs/srla_internal/include/srla_utility.h @@ -39,11 +39,11 @@ /* ビルトイン関数を使用 */ #define SRLAUTILITY_NLZ(x) (((x) > 0) ? (uint32_t)__builtin_clz(x) : 32U) #elif defined(_MSC_VER) +#include /* ビルトイン関数を使用 */ __inline uint32_t SRLAUTILITY_NLZ(uint32_t x) { - unsigned long result; - return (_BitScanReverse(&result, x) != 0) ? (31U - result) : 32U; + return __lzcnt(x); } #else /* ソフトウェア実装を使用 */