函数page_align

 

/************************************************************//**
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 > 0);
    ut_ad(((align_no - 1) & align_no) == 0);
    ut_ad(ptr);

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

    return((void*)((((ulint)ptr)) & ~(align_no - 1)));
}

 

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