lavu: add ff_parity()

This commit is contained in:
Clément Bœsch
2016-01-03 20:14:37 +01:00
parent d64fe951c2
commit 2ce29d1765
2 changed files with 14 additions and 0 deletions

View File

@@ -153,6 +153,18 @@ static av_always_inline av_const unsigned ff_clz_c(unsigned x)
}
#endif
#ifndef ff_parity
#define ff_parity ff_parity_c
static av_always_inline av_const int ff_parity_c(uint32_t v)
{
#if HAVE_PARITY
return __builtin_parity(v);
#else
return av_popcount(v) & 1;
#endif
}
#endif
/**
* @}
*/