函数page_align

时间:2023-03-08 19:28:09
/************************************************************//**
Gets the start of a page.
@return    start of the page */
UNIV_INLINE
page_t*
page_align(
/*=======*/
    const void*    ptr)    /*!< in: pointer to page frame */
{
    return((page_t*) ut_align_down(ptr, UNIV_PAGE_SIZE));
}

/*********************************************************//**
The following function rounds down a pointer to the nearest
aligned address.
@return    aligned pointer */
UNIV_INLINE
void*
ut_align_down(
/*==========*/
    const void*    ptr,        /*!< in: pointer */
    ulint        align_no)    /*!< in: align by this number */
{
    ut_ad(align_no > );
    ut_ad(((align_no - ) & align_no) == );
    ut_ad(ptr);

    ut_ad(sizeof(void*) == sizeof(ulint));

    )));
}