Il 13/11/2013 03:40, Alexey Kardashevskiy ha scritto: > I looked further and did not find any use of ffs/clz so I wonder what did > you mean about bitops.h and what did I miss? I am confused.
It's host-utils.h actually. The reason for the wrappers is twofold: (1) provide 32/64-bit functions instead of int/long/longlong; (2) support GCC <3.4. The wrappers are not usable where you have constant expressions as in your case. So your original patch is good IMO, except for the __ at the beginning of __BITNR. Paolo > So I would suggest the following instead (if I really needed this BITNR but > I really do not :) ) > > === > bitops: add BITNR macro > > This adds a macro to calculate the highest single bit set. If more than > one bit is set, returns -1.