On Sun, 3 Jan 2016 20:21:00 +0100 Clément Bœsch <u...@pkh.me> wrote:
> --- > configure | 2 ++ > libavutil/x86/intmath.h | 9 +++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/configure b/configure > index 6710f85..610be92 100755 > --- a/configure > +++ b/configure > @@ -1738,6 +1738,7 @@ BUILTIN_LIST=" > machine_rw_barrier > MemoryBarrier > mm_empty > + parity > rdtsc > sarestart > sync_val_compare_and_swap > @@ -5242,6 +5243,7 @@ check_builtin sarestart signal.h "SA_RESTART" > check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; > __sync_val_compare_and_swap(ptr, oldval, newval)" > check_builtin gmtime_r time.h "time_t *time; struct tm *tm; gmtime_r(time, > tm)" > check_builtin localtime_r time.h "time_t *time; struct tm *tm; > localtime_r(time, tm)" > +check_builtin parity "" "__builtin_parity(123)" > > case "$custom_allocator" in > jemalloc) > diff --git a/libavutil/x86/intmath.h b/libavutil/x86/intmath.h > index 611ef88..9c36bf2 100644 > --- a/libavutil/x86/intmath.h > +++ b/libavutil/x86/intmath.h > @@ -75,6 +75,15 @@ static av_always_inline av_const int ff_ctzll_x86(long > long v) > > #endif /* __POPCNT__ */ > > +static av_always_inline av_const int ff_parity(uint32_t v) > +{ > +#if HAVE_PARITY > + return __builtin_parity(v); > +#else > + return av_popcount(v) & 1; > +#endif Do compilers really generate better code for the former? > +} > + > #if defined(__BMI2__) > > #if AV_GCC_VERSION_AT_LEAST(5,1) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel