attempt at log2 implementation