Commit 5f53f4b4 authored by marko's avatar marko

page_align(ptr): New utility function to replace

ut_align_down(ptr, UNIV_PAGE_SIZE) calls.
parent c6004169
......@@ -1318,7 +1318,7 @@ btr_cur_update_in_place_log(
mtr_t* mtr) /* in: mtr */
{
byte* log_ptr;
page_t* page = ut_align_down(rec, UNIV_PAGE_SIZE);
page_t* page = page_align(rec);
ut_ad(flags < 256);
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
......
......@@ -88,7 +88,7 @@ btr_pcur_store_position(
page_cursor = btr_pcur_get_page_cur(cursor);
rec = page_cur_get_rec(page_cursor);
page = ut_align_down(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
offs = ut_align_offset(rec, UNIV_PAGE_SIZE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
......
......@@ -132,6 +132,15 @@ directory. */
#define PAGE_DIR_SLOT_MAX_N_OWNED 8
#define PAGE_DIR_SLOT_MIN_N_OWNED 4
/****************************************************************
Gets the start of a page. */
UNIV_INLINE
page_t*
page_align(
/*=======*/
/* out: start of the page */
void* ptr) /* in: pointer to page frame */
__attribute__((const));
/*****************************************************************
Returns the max trx id field value. */
UNIV_INLINE
......
......@@ -15,6 +15,17 @@ Created 2/2/1994 Heikki Tuuri
#define UNIV_INLINE
#endif
/****************************************************************
Gets the start of a page. */
UNIV_INLINE
page_t*
page_align(
/*=======*/
/* out: start of the page */
void* ptr) /* in: pointer to page frame */
{
return((page_t*) ut_align_down(ptr, UNIV_PAGE_SIZE));
}
/*****************************************************************
Returns the max trx id field value. */
UNIV_INLINE
......@@ -175,7 +186,7 @@ page_rec_is_comp(
/* out: nonzero if in compact format */
const rec_t* rec) /* in: record */
{
return(page_is_comp(ut_align_down((rec_t*) rec, UNIV_PAGE_SIZE)));
return(page_is_comp(page_align((rec_t*) rec)));
}
/****************************************************************
......@@ -550,7 +561,7 @@ page_rec_get_next(
ut_ad(page_rec_check(rec));
page = ut_align_down(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
offs = rec_get_next_offs(rec, page_is_comp(page));
......@@ -592,11 +603,11 @@ page_rec_set_next(
ut_ad(page_rec_check(rec));
ut_ad(!page_rec_is_supremum(rec));
page = ut_align_down(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
if (next) {
ut_ad(!page_rec_is_infimum(next));
ut_ad(page == ut_align_down(next, UNIV_PAGE_SIZE));
ut_ad(page == page_align(next));
offs = (ulint) (next - page);
} else {
offs = 0;
......@@ -623,7 +634,7 @@ page_rec_get_prev(
ut_ad(page_rec_check(rec));
page = ut_align_down(rec, UNIV_PAGE_SIZE);
page = page_align(rec);
ut_ad(!page_rec_is_infimum(rec));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment