Fix new log2 algorithm such that it compiles.

I also tested that it produces the same results as the old function before
jeremysalwen's PR.