计算某个数的对数(最大的)

例如 16 计算后为 4

2的4次方为16

例如15 计算后为3

2的3次方为8

/*************************************************************//**
Calculates fast the 2-logarithm of a number, rounded upward to an
integer.
@return    logarithm in the base 2, rounded upward */
UNIV_INLINE
ulint
ut_2_log(
/*=====*/
    ulint    n)    /*!< in: number != 0 */
{
    ulint    res;

    res = ;

    ut_ad(n > );

    n = n - ;

    for (;;) {
        n = n / ;

        ) {
            break;
        }

        res++;
    }

    );
}
05-01 04:35