corected merge errors and created i_log2(int) function