函数lock_rec_get_nth_bit

时间:2023-03-08 16:35:01
函数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 / ;
    bit_index = i % ;

     & ((])[byte_index] >> bit_index);
}