[flac-dev] About de Bruijn sequences in bitmath.h
lvqcl
lvqcl.mail at gmail.com
Fri Sep 6 15:24:08 PDT 2013
Ulrich Klauer <ulrich at chirlu.de> wrote:
> The canonical location is at CCAN: http://ccodearchive.net/info/ilog.html
> Note that the code is licensed LGPL. On the other hand, the author is
> Xiph.org's Timothy Terryberry, so he might be willing to relicense.
Thanks for the information.
I just thought that for x86 architecture it's faster to simply use 32-bit intrinsic:
/* FLAC__bitmath_ilog2(x) == _BitScanReverse(x) == 31 - __builtin_clz(x) */
static inline unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v)
{
#if _64bit_intrinsic_is_available
...
...
...
#else
if (v>0xFFFFFFFFU)
return 32+FLAC__bitmath_ilog2((FLAC__uint32)(v>>32));
else
return FLAC__bitmath_ilog2((FLAC__uint32)v);
#endif
}
More information about the flac-dev
mailing list