Handle pattern [0]:
int ctz(unsigned int a)
{
int c = __clz(a & -a); return a ? 31 - c : c;
}
In reality, the compiler can generate much better code for cttz, so fold away this pattern.
[0] https://community.arm.com/community-help/f/discussions/2114/count-trailing-zeros
I'd prefer that the comments use the same abbreviations as the intrinsics, ctlz and cttz (instead of clz and ctz).