From 7412995c94be2a6ef8132edf3b2b637ea410edea Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 21 May 2015 20:37:17 +0200 Subject: chmap: use av_popcount64() Saves us some code, and also happens to fix #1968. --- audio/chmap.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'audio') diff --git a/audio/chmap.c b/audio/chmap.c index 4fd43e3bc7..f04815d210 100644 --- a/audio/chmap.c +++ b/audio/chmap.c @@ -18,6 +18,8 @@ #include #include +#include + #include "common/common.h" #include "common/msg.h" #include "chmap.h" @@ -395,20 +397,12 @@ void mp_chmap_get_reorder(int src[MP_NUM_CHANNELS], const struct mp_chmap *from, assert(src[n] < 0 || (to->speaker[n] == from->speaker[src[n]])); } -static int popcount64(uint64_t bits) -{ - int r = 0; - for (int n = 0; n < 64; n++) - r += !!(bits & (1ULL << n)); - return r; -} - // Return the number of channels only in a. int mp_chmap_diffn(const struct mp_chmap *a, const struct mp_chmap *b) { uint64_t a_mask = mp_chmap_to_lavc_unchecked(a); uint64_t b_mask = mp_chmap_to_lavc_unchecked(b); - return popcount64((a_mask ^ b_mask) & a_mask); + return av_popcount64((a_mask ^ b_mask) & a_mask); } // Returns something like "fl-fr-fc". If there's a standard layout in lavc -- cgit v1.2.3