summaryrefslogtreecommitdiff
path: root/jcphuff.c
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2021-01-28 21:53:14 -0800
committerHaibo Huang <hhb@google.com>2021-01-28 21:53:14 -0800
commitf7bb80dc5eb581060f92d9f27e7326e1c03a0cdc (patch)
treef616cbf164716ee566a2b186cfc40a4d23540fdf /jcphuff.c
parent8091842bf92addd9e7f089a5a13f913c5596d502 (diff)
parentfa0de07678c9828cc57b3eb086c03771912ba527 (diff)
Upgrade libjpeg-turbo to fa0de07678c9828cc57b3eb086c03771912ba527
Test: make Change-Id: I5de273521ea963ae8720779874e9796e94433cd9
Diffstat (limited to 'jcphuff.c')
-rw-r--r--jcphuff.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/jcphuff.c b/jcphuff.c
index a8b94be..373d71f 100644
--- a/jcphuff.c
+++ b/jcphuff.c
@@ -6,6 +6,7 @@
* libjpeg-turbo Modifications:
* Copyright (C) 2011, 2015, 2018, D. R. Commander.
* Copyright (C) 2016, 2018, Matthieu Darbois.
+ * Copyright (C) 2020, Arm Limited.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@@ -51,15 +52,19 @@
* flags (this defines __thumb__).
*/
-/* NOTE: Both GCC and Clang define __GNUC__ */
-#if defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))
+#if defined(__arm__) || defined(__aarch64__) || defined(_M_ARM) || \
+ defined(_M_ARM64)
#if !defined(__thumb__) || defined(__thumb2__)
#define USE_CLZ_INTRINSIC
#endif
#endif
#ifdef USE_CLZ_INTRINSIC
+#if defined(_MSC_VER) && !defined(__clang__)
+#define JPEG_NBITS_NONZERO(x) (32 - _CountLeadingZeros(x))
+#else
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
+#endif
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
#else
#include "jpeg_nbits_table.h"