ndigits0z(n::BigInt, b): avoid expensive off-by-one check for b=2^k.

Fixes #8727, but it's kind of a bandaid since for non-power-of-two
bases ndigits0z is still slow due to GMP's inexcusable laziness. At
least for power-of-two bases, however, BigInt hashing is now about
3x faster and allocates no memory.

(cherry picked from commit 19eb2faf3c80dd327f3c711f614d7610674a2d97)