int iResidue = sizeof(array) / sizeof(array[0]); for(; iResidue; iBits++) { iResidue >>= 1; iBits++; }