also, you want to compute the max first and then to find the number of bits.