函数lock_rec_get_nth_bit

 

/*********************************************************************//**
Gets the nth bit of a record lock.
@return    TRUE if bit set also if i == ULINT_UNDEFINED return FALSE*/
UNIV_INLINE
ibool
lock_rec_get_nth_bit(
/*=================*/
    const lock_t*    lock,    /*!< in: record lock */
    ulint        i)    /*!< in: index of the bit */
{
    ulint    byte_index;
    ulint    bit_index;

    ut_ad(lock);
    ut_ad(lock_get_type_low(lock) == LOCK_REC);

    if (i >= lock->un_member.rec_lock.n_bits) {

        return(FALSE);
    }

    byte_index = i / 8;
    bit_index = i % 8;

    return(1 & ((const byte*) &lock[1])[byte_index] >> bit_index);
}

 

你可能感兴趣的:(函数lock_rec_get_nth_bit)