[FFmpeg-devel] [PATCH 1/3] common: add ff_parity()
Clément Bœsch
u at pkh.me
Sun Jan 3 22:33:00 CET 2016
On Sun, Jan 03, 2016 at 05:54:34PM -0300, James Almer wrote:
> On 1/3/2016 4:22 PM, Clément Bœsch wrote:
> > 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
>
> Are you sure that's correct for an uint32_t?
>
Erm. Yeah no, my bad.
> >
> > Whatever people prefers
>
> No need for the configure check. Make the above the c generic version (Add it to
> common.h or intmath.h), then on x86/intmath.h make it use __builtin_parity if
> __GNU__ is true.
Why should we use __builtin_parity only on x86?
[...]
--
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/c94d18e7/attachment.sig>
More information about the ffmpeg-devel
mailing list