util: Do not use log10 to count the digits of an integer.

Using integer arithmetic is more logical and allow us to get rid of some
warnings.