Thanks for posting this, I was faced with that exact same problem this week. But with the following extra constraints :
- Not everybody uses GCC, especially in the embedded world where CLZ is most useful
- It must be portable to a Cortex-M0+ that doesn't have a CLZ instruction
Like me you probably end up here :
http://embeddedgurus.com/state-space/2014/09/fast-determinis...