From 4b838c38f92f480edf2bc4c763ea8de9a5d0a3cd Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 11 Jan 2021 13:45:25 -0600 Subject: [PATCH] jcphuff.c: Fix compiler warning with clang-cl Fixes #492 --- jcphuff.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/jcphuff.c b/jcphuff.c index a8b94bed..b6fd10d1 100644 --- a/jcphuff.c +++ b/jcphuff.c @@ -4,7 +4,7 @@ * This file was part of the Independent JPEG Group's software: * Copyright (C) 1995-1997, Thomas G. Lane. * libjpeg-turbo Modifications: - * Copyright (C) 2011, 2015, 2018, D. R. Commander. + * Copyright (C) 2011, 2015, 2018, 2021, D. R. Commander. * Copyright (C) 2016, 2018, Matthieu Darbois. * For conditions of distribution and use, see the accompanying README.ijg * file. @@ -169,24 +169,26 @@ INLINE METHODDEF(int) count_zeroes(size_t *x) { - int result; #if defined(HAVE_BUILTIN_CTZL) + int result; result = __builtin_ctzl(*x); *x >>= result; #elif defined(HAVE_BITSCANFORWARD64) + unsigned long result; _BitScanForward64(&result, *x); *x >>= result; #elif defined(HAVE_BITSCANFORWARD) + unsigned long result; _BitScanForward(&result, *x); *x >>= result; #else - result = 0; + int result = 0; while ((*x & 1) == 0) { ++result; *x >>= 1; } #endif - return result; + return (int)result; }