Yes. Since you're using GCC, you may use the __builtin_ctz family of built-in functions for trailing zero count,
int __builtin_ctz (unsigned int x);
as taken from http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html .
For instance,
2 == __builtin_ctz(188)
A word of warning: For the input 0, the result is undefined. Therefore its use may need to be guarded, thus:
int safe_ctz(unsigned int x){
return x ? __builtin_ctz(x) : 32;
}
The advantage of this builtin is that for some targets, GCC turns this to a single instruction, such as BSF on x86.