Pádraig Brady wrote:
Gisle, how does this this version work for you? http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=lib/count-leading-zeros.h;h=5904eb7f
Compiling that, results in some warnings: count-leading-zeros.h(42) : warning C4083: expected '('; found identifier '_BitScanReverse' count-leading-zeros.h(43) : warning C4083: expected '('; found identifier '_BitScanReverse64' diff on diff: --- count-leading-zeros.h.git 2015-01-06 19:16:49 +0000 +++ count-leading-zeros.h 2015-01-06 19:14:19 +0000 @@ -39,8 +39,8 @@ # define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ return x ? BUILTIN (x) : CHAR_BIT * sizeof x; #elif _MSC_VER -# pragma intrinsic _BitScanReverse -# pragma intrinsic _BitScanReverse64 +# pragma intrinsic (_BitScanReverse) +# pragma intrinsic (_BitScanReverse64) # define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ do \ { \ But MSVC v16 still warns: count-leading-zeros.h(43) : warning C4163: '_BitScanReverse64' : not available as an intrinsic function And the dis-asm of test-leading-zeros.obj still has: _count_leading_zeros_ll: push ebp mov ebp,esp sub esp,0x00000008 X$72: mov eax,dword ptr 0xc[ebp] push eax mov ecx,dword ptr 0x8[ebp] push ecx lea edx,-0x4[ebp] push edx call j^__BitScanReverse64 According to: http://msdn.microsoft.com/en-us/library/fbxyd7zd.aspx the requirement for '_BitScanReverse64' is ARM, x64. I.e. not x86. -- --gv