As far as I can tell, there is no requirement that the first 1 bit will only be followed by 1 bits, thus merely computing the number of trialing zeroes of the bitwise negated value is not guaranteed to give the correct answer.
Oops, you're right. I concluded that from his examples, but it is certainly not a requirement. In this case, my solution is crap :-)

Greets,
Philip