Bug 1448627 - Don't use __popcnt intrinsec on windows. r?padenot draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Sun, 25 Mar 2018 11:37:31 +0200
changeset 772168 aee3b32a164fa8f183b19576727f809e6cd96140
parent 772164 8a4bb920ffab7e8d1e599c0b26d748e39021e2f4
push id103868
push userbmo:jyavenard@mozilla.com
push dateSun, 25 Mar 2018 09:39:06 +0000
reviewerspadenot
bugs1448627
milestone61.0a1
Bug 1448627 - Don't use __popcnt intrinsec on windows. r?padenot Not all processors support it. update cubeb to e02d15d34 MozReview-Commit-ID: FmLnYsm8OKZ
media/libcubeb/README_MOZILLA
media/libcubeb/src/cubeb_mixer.cpp
--- a/media/libcubeb/README_MOZILLA
+++ b/media/libcubeb/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the cubeb
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 Makefile.in build files for the Mozilla build system.
 
 The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
 
-The git commit ID used was 77cb1a9a37bb9fcc43743770727cb6a31b27ab74 (2018-03-23 14:38:34 +1000)
+The git commit ID used was e02d15d34eb737136e04a7bbf82801742a89e53b (2018-03-25 11:16:30 +0200)
--- a/media/libcubeb/src/cubeb_mixer.cpp
+++ b/media/libcubeb/src/cubeb_mixer.cpp
@@ -9,19 +9,16 @@
 
 #define NOMINMAX
 
 #include <algorithm>
 #include <cassert>
 #include <climits>
 #include <cmath>
 #include <cstdlib>
-#ifdef _MSC_VER
-#include <intrin.h>
-#endif
 #include <memory>
 #include <type_traits>
 #include "cubeb-internal.h"
 #include "cubeb_mixer.h"
 #include "cubeb_utils.h"
 
 #ifndef FF_ARRAY_ELEMS
 #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
@@ -75,26 +72,25 @@ cubeb_channel_layout_check(cubeb_channel
     }
     return l;
 }
 
 unsigned int cubeb_channel_layout_nb_channels(cubeb_channel_layout x)
 {
 #if __GNUC__ || __clang__
   return __builtin_popcount (x);
-#elif _MSC_VER
-  return __popcnt(x);
 #else
   x -= (x >> 1) & 0x55555555;
   x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
   x = (x + (x >> 4)) & 0x0F0F0F0F;
   x += x >> 8;
   return (x + (x >> 16)) & 0x3F;
 #endif
 }
+
 struct MixerContext {
   MixerContext(cubeb_sample_format f,
                uint32_t in_channels,
                cubeb_channel_layout in,
                uint32_t out_channels,
                cubeb_channel_layout out)
     : _format(f)
     , _in_ch_layout(cubeb_channel_layout_check(in, in_channels))