diff --git a/media-video/ffmpeg/additional-files/gcc_runtime.c b/media-video/ffmpeg/additional-files/gcc_runtime.c index b53c82ac6..988dae0a5 100644 --- a/media-video/ffmpeg/additional-files/gcc_runtime.c +++ b/media-video/ffmpeg/additional-files/gcc_runtime.c @@ -402,3 +402,25 @@ __ctzdi2 (UDWtype x) count_trailing_zeros (ret, word); return ret + add; } + +#define POPCOUNTCST2(x) (((UWtype) x << __CHAR_BIT__) | x) +#define POPCOUNTCST4(x) (((UWtype) x << (2 * __CHAR_BIT__)) | x) +#define POPCOUNTCST8(x) (((UWtype) x << (4 * __CHAR_BIT__)) | x) +#if W_TYPE_SIZE == __CHAR_BIT__ +#define POPCOUNTCST(x) x +#elif W_TYPE_SIZE == 2 * __CHAR_BIT__ +#define POPCOUNTCST(x) POPCOUNTCST2 (x) +#elif W_TYPE_SIZE == 4 * __CHAR_BIT__ +#define POPCOUNTCST(x) POPCOUNTCST4 (POPCOUNTCST2 (x)) +#elif W_TYPE_SIZE == 8 * __CHAR_BIT__ +#define POPCOUNTCST(x) POPCOUNTCST8 (POPCOUNTCST4 (POPCOUNTCST2 (x))) +#endif + +int +__popcountsi2 (UWtype x) +{ + x = x - ((x >> 1) & POPCOUNTCST (0x55)); + x = (x & POPCOUNTCST (0x33)) + ((x >> 2) & POPCOUNTCST (0x33)); + x = (x + (x >> 4)) & POPCOUNTCST (0x0F); + return (x * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - __CHAR_BIT__); +} diff --git a/media-video/ffmpeg/ffmpeg7-7.1.2.recipe b/media-video/ffmpeg/ffmpeg7-7.1.2.recipe index 59b602400..abbc8b8b9 100644 --- a/media-video/ffmpeg/ffmpeg7-7.1.2.recipe +++ b/media-video/ffmpeg/ffmpeg7-7.1.2.recipe @@ -240,7 +240,7 @@ BUILD() cc="gcc${gccSuffix/_/-}" ccArgs="--cc=$cc --cxx=g++${secondaryArchSuffix/_/-} --ld=gcc${secondaryArchSuffix/_/-} - --host-ld=gcc${secondaryArchSuffix/_/-} --extra-cflags=-fno-builtin-popcount" + --host-ld=gcc${secondaryArchSuffix/_/-}" # Hack up base headers to make them think we're on GCC2 ABI mkdir -p include_hacks include_hacks/os include_hacks/config