Commit 2ce29d17 authored by Clément Bœsch's avatar Clément Bœsch

lavu: add ff_parity()

parent d64fe951
...@@ -1736,6 +1736,7 @@ BUILTIN_LIST=" ...@@ -1736,6 +1736,7 @@ BUILTIN_LIST="
machine_rw_barrier machine_rw_barrier
MemoryBarrier MemoryBarrier
mm_empty mm_empty
parity
rdtsc rdtsc
sarestart sarestart
sync_val_compare_and_swap sync_val_compare_and_swap
...@@ -5241,6 +5242,7 @@ check_builtin sarestart signal.h "SA_RESTART" ...@@ -5241,6 +5242,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 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 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 localtime_r time.h "time_t *time; struct tm *tm; localtime_r(time, tm)"
check_builtin parity "" "__builtin_parity(123)"
case "$custom_allocator" in case "$custom_allocator" in
jemalloc) jemalloc)
......
...@@ -153,6 +153,18 @@ static av_always_inline av_const unsigned ff_clz_c(unsigned x) ...@@ -153,6 +153,18 @@ static av_always_inline av_const unsigned ff_clz_c(unsigned x)
} }
#endif #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
/** /**
* @} * @}
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment