[FFmpeg-devel] [PATCH] avutil/intmath: use de Bruijn based ff_ctz

James Almer jamrial at gmail.com
Mon Oct 12 06:37:52 CEST 2015


On 10/11/2015 10:55 PM, Ganesh Ajjanagadde wrote:
> It has already been demonstrated that the de Bruijn method has benefits
> over the current implementation: commit 971d12b7f9d7be3ca8eb98e6c04ed521f83cbd3c.
> That commit implemented it for long long, this extends it to the 32 bit
> version.
> 
> The function is renamed from ff_ctz to ff_ctz32 since it crucially
> depends on the 32 bit width of its argument. This is not an issue, as the
> only usage in avcodec/flacenc uses an int32_t anyway.

I personally don't think the renaming is needed, for that matter. The
function takes an int as argument, and as far as ffmpeg supported arches
go those are 32 bits.
If you really want to be sure, just add a comment that the argument
absolutely needs to be 32 bits and that should be enough.


More information about the ffmpeg-devel mailing list