From d531243c986dd613c5b2bf110d604cdc2d11d9e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Heres?= Date: Tue, 20 Oct 2015 18:10:05 +0200 Subject: [PATCH] Optimize bitscanforward using intrinsic function --- src/util/util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/util/util.c b/src/util/util.c index f17ac3f424..d7f081357b 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -143,11 +143,16 @@ int bitscanforward(int source) { int i; + #if _MSC_VER >= 1400 // Visual Studio 2005 + _BitScanForward(&i, source); + return i; + #else for (i = 0; i < 32; i++) if (source & (1 << i)) return i; return -1; + #endif } int bitcount(int source)