026eb22
From 416fb93dae5009bb51da9f6720a95918a2c79e78 Mon Sep 17 00:00:00 2001
026eb22
From: Oliver Wolff <oliver.wolff@qt.io>
026eb22
Date: Fri, 17 Aug 2018 09:54:15 +0200
026eb22
Subject: [PATCH] ANGLE: Fix build for ARM
026eb22
026eb22
__popcnt is not available when building for ARM. This patch uses the
026eb22
approach that is also used in Microsoft's ANGLE fork.
026eb22
026eb22
Change-Id: I98bac36a3b36b0aa81f3b483d3d12cce9f6c5c87
026eb22
---
026eb22
 src/3rdparty/angle/src/common/mathutil.h | 9 +++++++++
026eb22
 1 file changed, 9 insertions(+)
026eb22
026eb22
diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
026eb22
index ca6efc567f..372e432066 100644
026eb22
--- a/src/3rdparty/angle/src/common/mathutil.h
026eb22
+++ b/src/3rdparty/angle/src/common/mathutil.h
026eb22
@@ -884,6 +884,14 @@ inline uint32_t BitfieldReverse(uint32_t value)
026eb22
 
026eb22
 // Count the 1 bits.
026eb22
 #if defined(ANGLE_PLATFORM_WINDOWS)
026eb22
+#if defined(_M_ARM)
026eb22
+inline int BitCount(uint32_t bits)
026eb22
+{
026eb22
+    bits = bits - ((bits >> 1) & 0x55555555);
026eb22
+    bits = (bits & 0x33333333) + ((bits >> 2) & 0x33333333);
026eb22
+    return (((bits + (bits >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
026eb22
+}
026eb22
+#else // _M_ARM
026eb22
 inline int BitCount(uint32_t bits)
026eb22
 {
026eb22
     return static_cast<int>(__popcnt(bits));
026eb22
@@ -893,6 +901,7 @@ inline int BitCount(uint64_t bits)
026eb22
 {
026eb22
     return static_cast<int>(__popcnt64(bits));
026eb22
 }
026eb22
+#endif // !_M_ARM
026eb22
 #endif  // defined(ANGLE_IS_64_BIT_CPU)
026eb22
 #endif  // defined(ANGLE_PLATFORM_WINDOWS)
026eb22
 
026eb22
-- 
026eb22
2.15.0.windows.1
026eb22