mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
intmath: add faster clz support
This commit is contained in:
parent
5ff3b5cafc
commit
7bfda7d157
@ -44,6 +44,10 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif /* ff_log2 */
|
#endif /* ff_log2 */
|
||||||
|
|
||||||
|
#ifndef ff_clz
|
||||||
|
# define ff_clz(v) __builtin_clz(v)
|
||||||
|
#endif /* ff_clz */
|
||||||
|
|
||||||
#endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
|
#endif /* AV_GCC_VERSION_AT_LEAST(3,4) */
|
||||||
|
|
||||||
extern const uint8_t ff_log2_tab[256];
|
extern const uint8_t ff_log2_tab[256];
|
||||||
@ -132,6 +136,21 @@ static av_always_inline av_const int ff_ctz_c(int v)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ff_clz
|
||||||
|
#define ff_clz ff_clz_c
|
||||||
|
static av_always_inline av_const unsigned ff_clz_c(unsigned x)
|
||||||
|
{
|
||||||
|
unsigned i = sizeof(x) * 8;
|
||||||
|
|
||||||
|
while (x) {
|
||||||
|
x >>= 1;
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trailing zero bit count.
|
* Trailing zero bit count.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user