[FFmpeg-devel] [PATCH 1/3] common: add ff_parity()

Clément Bœsch u at pkh.me
Sun Jan 3 20:22:15 CET 2016


On Sun, Jan 03, 2016 at 08:21:00PM +0100, Clément Bœsch wrote:
[...]
> +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;

doing a popcount being overkill, this could be replaced with
(0x6996966996696996ULL >> (x & 63) ^ (x>>7) ^ (x>>6)) & 1

Whatever people prefers

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160103/3b8c6db4/attachment.sig>


More information about the ffmpeg-devel mailing list