Ulrich Klauer <ulr...@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
}
_______________________________________________
flac-dev mailing list
flac-dev@xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev

Reply via email to