Edit: I completely misunderstood what you wanted.
Here is what you want:
The number of significant bits at 0 is 0.
The number of significant bits in xis the number of significant bits in x/2plus one.
So you get:
template <unsigned int x>
struct SignificantBits {
static const unsigned int n = SignificantBits<x/2>::n + 1;
};
template <>
struct SignificantBits<0> {
static const unsigned int n = 0;
};